Fix Elk-M1 missing TLS 1.2 check (#140672)

* Fix for missing TLS 1.2 check

* Fix error message.

* combine startswith

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Glenn Waters 2025-03-15 17:07:45 -04:00 committed by Franck Nijhof
parent 85b6b3a360
commit c9ceade10d
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -101,9 +101,11 @@ def hostname_from_url(url: str) -> str:
def _host_validator(config: dict[str, str]) -> dict[str, str]:
"""Validate that a host is properly configured."""
if config[CONF_HOST].startswith("elks://"):
if config[CONF_HOST].startswith(("elks://", "elksv1_2://")):
if CONF_USERNAME not in config or CONF_PASSWORD not in config:
raise vol.Invalid("Specify username and password for elks://")
raise vol.Invalid(
"Specify username and password for elks:// or elksv1_2://"
)
elif not config[CONF_HOST].startswith("elk://") and not config[
CONF_HOST
].startswith("serial://"):