mirror of
https://github.com/esphome/esphome.git
synced 2026-10-06 10:56:43 +00:00
Merge branch 'dev' into jesserockz-2026-446
This commit is contained in:
@@ -300,6 +300,16 @@ def add_pin_validators():
|
||||
"modes": ["input"],
|
||||
}
|
||||
|
||||
from esphome.components import gpio_expander
|
||||
|
||||
# Wraps pins.internal_gpio_input_pin_schema, so the editor schema must keep
|
||||
# treating the config var as a pin
|
||||
pin_validators[repr(gpio_expander.validate_interrupt_pin)] = {
|
||||
"schema": True,
|
||||
"internal": True,
|
||||
"modes": ["input"],
|
||||
}
|
||||
|
||||
|
||||
def add_module_registries(domain, module):
|
||||
for attr_name in dir(module):
|
||||
@@ -1256,13 +1266,29 @@ def convert_keys(converted, schema, path):
|
||||
else:
|
||||
converted["key"] = "String"
|
||||
key_string_match = re.search(
|
||||
r"<function (\w*) at \w*>", str(k), re.IGNORECASE
|
||||
r"<function ([^ ]+) at \w+>", str(k), re.IGNORECASE
|
||||
)
|
||||
if key_string_match:
|
||||
converted["key_type"] = key_string_match.group(1)
|
||||
else:
|
||||
converted["key_type"] = str(k)
|
||||
|
||||
# A marker-wrapped callable key (e.g. script.execute's
|
||||
# ``cv.Optional(validate_parameter_name)``) is a wildcard matcher;
|
||||
# ``str(marker)`` is the function repr, whose heap address would
|
||||
# churn the dump every build. Normalize like the bare-callable
|
||||
# branch above: record the validator name in ``key_type`` and file
|
||||
# the config var under ``string``.
|
||||
key_name = str(k)
|
||||
if isinstance(k, vol.Marker) and callable(k.schema):
|
||||
key_string_match = re.search(
|
||||
r"<function ([^ ]+) at \w+>", key_name, re.IGNORECASE
|
||||
)
|
||||
result["key_type"] = (
|
||||
key_string_match.group(1) if key_string_match else key_name
|
||||
)
|
||||
key_name = "string"
|
||||
|
||||
# ``cv.OnlyWith`` / ``cv.OnlyWithout`` expose ``default`` as
|
||||
# a property that returns ``vol.UNDEFINED`` when the gating
|
||||
# component isn't loaded — and at schema-generation time
|
||||
@@ -1342,7 +1368,7 @@ def convert_keys(converted, schema, path):
|
||||
for base_k, base_v in get_overridden_config(k, converted).items():
|
||||
if base_k in result and base_v == result[base_k]:
|
||||
result.pop(base_k)
|
||||
converted["schema"][S_CONFIG_VARS][str(k)] = result
|
||||
converted["schema"][S_CONFIG_VARS][key_name] = result
|
||||
if "key" in converted and converted["key"] == "String":
|
||||
config_vars = converted["schema"]["config_vars"]
|
||||
assert len(config_vars) == 1
|
||||
|
||||
Reference in New Issue
Block a user