From 273343b182175a150fa82e368b1eb74e953d1f76 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Mon, 28 Apr 2025 14:07:29 +1200 Subject: [PATCH] Fix log api client when no hardcoded encryption key --- esphome/components/api/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/esphome/components/api/client.py b/esphome/components/api/client.py index c61b8d5ea3..9b30d844c7 100644 --- a/esphome/components/api/client.py +++ b/esphome/components/api/client.py @@ -29,8 +29,9 @@ 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_config := conf.get(CONF_ENCRYPTION): + if key := encryption_config.get(CONF_KEY): + noise_psk = key _LOGGER.info("Starting log output from %s using esphome API", address) cli = APIClient( address,