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 GitHub
parent ed0b1f58dc
commit 76244e0d6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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://"):