1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-04 04:12:23 +01:00

Separate OTABackend from OTA component (#6459)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Keith Burzinski
2024-05-15 21:01:09 -05:00
committed by GitHub
parent f91c31f093
commit f46c499c4e
40 changed files with 505 additions and 391 deletions

View File

@@ -3,14 +3,16 @@ import logging
from esphome.const import (
CONF_DISABLED_BY_DEFAULT,
CONF_ENTITY_CATEGORY,
CONF_ESPHOME,
CONF_ICON,
CONF_INTERNAL,
CONF_NAME,
CONF_SETUP_PRIORITY,
CONF_UPDATE_INTERVAL,
CONF_TYPE_ID,
CONF_OTA,
CONF_PLATFORM,
CONF_SAFE_MODE,
CONF_SETUP_PRIORITY,
CONF_TYPE_ID,
CONF_UPDATE_INTERVAL,
KEY_PAST_SAFE_MODE,
)
@@ -139,9 +141,16 @@ async def build_registry_list(registry, config):
async def past_safe_mode():
safe_mode_enabled = (
CONF_OTA in CORE.config and CORE.config[CONF_OTA][CONF_SAFE_MODE]
)
ota_conf = {}
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
safe_mode_enabled = ota_conf[CONF_SAFE_MODE]
if not safe_mode_enabled:
return