[safe_mode] Set safe mode core data in disabled cases (#6983)

This commit is contained in:
Jesse Hills 2024-06-25 21:07:19 +12:00
parent 0262a99274
commit 7be071a0e9
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A

View file

@ -56,9 +56,7 @@ CONFIG_SCHEMA = cv.All(
@coroutine_with_priority(50.0) @coroutine_with_priority(50.0)
async def to_code(config): async def to_code(config):
if config[CONF_DISABLED]: if not config[CONF_DISABLED]:
return
var = cg.new_Pvariable(config[CONF_ID]) var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config) await cg.register_component(var, config)
@ -72,5 +70,6 @@ async def to_code(config):
config[CONF_BOOT_IS_GOOD_AFTER], config[CONF_BOOT_IS_GOOD_AFTER],
) )
cg.add(RawExpression(f"if ({condition}) return")) cg.add(RawExpression(f"if ({condition}) return"))
CORE.data[CONF_SAFE_MODE] = {} CORE.data[CONF_SAFE_MODE] = {}
CORE.data[CONF_SAFE_MODE][KEY_PAST_SAFE_MODE] = True CORE.data[CONF_SAFE_MODE][KEY_PAST_SAFE_MODE] = True