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

Uncouple safe_mode from OTA (#6759)

This commit is contained in:
Keith Burzinski
2024-05-21 20:08:53 -05:00
committed by GitHub
parent 83d3584173
commit 76abf2200c
21 changed files with 282 additions and 200 deletions

View File

@@ -3,12 +3,9 @@ import logging
from esphome.const import (
CONF_DISABLED_BY_DEFAULT,
CONF_ENTITY_CATEGORY,
CONF_ESPHOME,
CONF_ICON,
CONF_INTERNAL,
CONF_NAME,
CONF_OTA,
CONF_PLATFORM,
CONF_SAFE_MODE,
CONF_SETUP_PRIORITY,
CONF_TYPE_ID,
@@ -141,22 +138,12 @@ async def build_registry_list(registry, config):
async def past_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:
if CONF_SAFE_MODE not in CORE.config:
return
def _safe_mode_generator():
while True:
if CORE.data.get(CONF_OTA, {}).get(KEY_PAST_SAFE_MODE, False):
if CORE.data.get(CONF_SAFE_MODE, {}).get(KEY_PAST_SAFE_MODE, False):
return
yield