load_yaml cannot resolve !extend, switching to the full CORE.config

This commit is contained in:
Gábor Poczkodi 2024-11-09 04:18:40 +01:00
parent 0ec353c112
commit 68838a72c8

View file

@ -1,7 +1,9 @@
import copy
import esphome.codegen as cg import esphome.codegen as cg
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome import automation, yaml_util from esphome import automation, yaml_util
from esphome.core import CORE from esphome.core import CORE
from esphome.config import strip_default_ids
from esphome.const import ( from esphome.const import (
CONF_ID, CONF_ID,
@ -27,7 +29,7 @@ async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID]) var = cg.new_Pvariable(config[CONF_ID])
store_yaml = await cg.register_component(var, config) store_yaml = await cg.register_component(var, config)
cg.add(store_yaml.set_show_in_dump_config(config[CONF_SHOW_IN_DUMP_CONFIG])) cg.add(store_yaml.set_show_in_dump_config(config[CONF_SHOW_IN_DUMP_CONFIG]))
yaml = yaml_util.load_yaml(CORE.config_path) yaml = strip_default_ids(copy.deepcopy(CORE.config))
dump = yaml_util.dump(yaml, show_secrets=config[CONF_SHOW_SECRETS]) dump = yaml_util.dump(yaml, show_secrets=config[CONF_SHOW_SECRETS])
cg.add(store_yaml.set_yaml(dump)) cg.add(store_yaml.set_yaml(dump))