Fix api log client crashing when api encryption is dynamic (#9245)

This commit is contained in:
Jesse Hills 2025-06-30 08:07:29 +12:00
parent 90f9ab0d3e
commit bdc9f5f3b2
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A

View File

@ -29,8 +29,8 @@ async def async_run_logs(config: dict[str, Any], address: str) -> None:
port: int = int(conf[CONF_PORT])
password: str = conf[CONF_PASSWORD]
noise_psk: str | None = None
if CONF_ENCRYPTION in conf:
noise_psk = conf[CONF_ENCRYPTION][CONF_KEY]
if (encryption := conf.get(CONF_ENCRYPTION)) and (key := encryption.get(CONF_KEY)):
noise_psk = key
_LOGGER.info("Starting log output from %s using esphome API", address)
cli = APIClient(
address,