From 164936c5fb9e65f4dca09bbefddc428874e774f2 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Mon, 29 Apr 2024 11:50:23 +1200 Subject: [PATCH] The walrus ran away --- esphome/__main__.py | 9 ++++----- esphome/cpp_helpers.py | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/esphome/__main__.py b/esphome/__main__.py index a83cbbfeb1..9930119c86 100644 --- a/esphome/__main__.py +++ b/esphome/__main__.py @@ -332,11 +332,10 @@ def upload_program(config, args, host): return 1 # Unknown target platform ota_conf = {} - if ota := config.get(CONF_OTA): - for ota_item in ota: - if ota_item[CONF_PLATFORM] == CONF_ESPHOME: - ota_conf = ota_item - break + for ota_item in config.get(CONF_OTA, []): + if ota_item[CONF_PLATFORM] == CONF_ESPHOME: + ota_conf = ota_item + break if not ota_conf: raise EsphomeError( diff --git a/esphome/cpp_helpers.py b/esphome/cpp_helpers.py index 402f60284e..ce494e5d9d 100644 --- a/esphome/cpp_helpers.py +++ b/esphome/cpp_helpers.py @@ -142,11 +142,10 @@ async def build_registry_list(registry, config): async def past_safe_mode(): ota_conf = {} - if CONF_OTA in CORE.config: - for ota_item in CORE.config.get(CONF_OTA): - if ota_item[CONF_PLATFORM] == CONF_ESPHOME: - ota_conf = ota_item - break + for ota_item in CORE.config.get(CONF_OTA, []): + if ota_item[CONF_PLATFORM] == CONF_ESPHOME: + ota_conf = ota_item + break if not ota_conf: return