This commit is contained in:
Tomasz Duda 2024-10-31 18:09:13 +01:00
commit 094b9a7d40

View file

@ -85,12 +85,12 @@ def load_components():
# pylint: disable=wrong-import-position # pylint: disable=wrong-import-position
from esphome.const import CONF_TYPE, KEY_CORE from esphome.const import CONF_TYPE, KEY_CORE, KEY_TARGET_PLATFORM
from esphome.core import CORE from esphome.core import CORE
# pylint: enable=wrong-import-position # pylint: enable=wrong-import-position
CORE.data[KEY_CORE] = {} CORE.data[KEY_CORE] = {KEY_TARGET_PLATFORM: None}
load_components() load_components()
# Import esphome after loading components (so schema is tracked) # Import esphome after loading components (so schema is tracked)
@ -394,9 +394,8 @@ def add_referenced_recursive(referenced_schemas, config_var, path, eat_schema=Fa
for k in schema.get(S_EXTENDS, []): for k in schema.get(S_EXTENDS, []):
if k not in referenced_schemas: if k not in referenced_schemas:
referenced_schemas[k] = [path] referenced_schemas[k] = [path]
else: elif path not in referenced_schemas[k]:
if path not in referenced_schemas[k]: referenced_schemas[k].append(path)
referenced_schemas[k].append(path)
s1 = get_str_path_schema(k) s1 = get_str_path_schema(k)
p = k.split(".") p = k.split(".")
@ -868,13 +867,12 @@ def convert(schema, config_var, path):
config_var[S_TYPE] = "use_id" config_var[S_TYPE] = "use_id"
else: else:
print("TODO deferred?") print("TODO deferred?")
elif isinstance(data, str):
# TODO: Figure out why pipsolar does this
config_var["use_id_type"] = data
else: else:
if isinstance(data, str): config_var["use_id_type"] = str(data.base)
# TODO: Figure out why pipsolar does this config_var[S_TYPE] = "use_id"
config_var["use_id_type"] = data
else:
config_var["use_id_type"] = str(data.base)
config_var[S_TYPE] = "use_id"
else: else:
raise TypeError("Unknown extracted schema type") raise TypeError("Unknown extracted schema type")
elif config_var.get("key") == "GeneratedID": elif config_var.get("key") == "GeneratedID":