mirror of
https://github.com/home-assistant/core.git
synced 2025-11-17 23:10:28 +00:00
Use entity registry id in toggle_entity device automations (#94995)
* Use entity registry id in toggle_entity device automations * Update tests --------- Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
@@ -25,6 +25,8 @@ STATIC_VALIDATOR = {
|
||||
DeviceAutomationType.TRIGGER: "TRIGGER_SCHEMA",
|
||||
}
|
||||
|
||||
TOGGLE_ENTITY_DOMAINS = {"fan", "humidifier", "light", "remote", "switch"}
|
||||
|
||||
|
||||
async def async_validate_device_automation_config(
|
||||
hass: HomeAssistant,
|
||||
@@ -43,6 +45,16 @@ async def async_validate_device_automation_config(
|
||||
ConfigType, getattr(platform, STATIC_VALIDATOR[automation_type])(config)
|
||||
)
|
||||
|
||||
# Bypass checks for toggle entity domains
|
||||
if (
|
||||
automation_type == DeviceAutomationType.ACTION
|
||||
and validated_config[CONF_DOMAIN] in TOGGLE_ENTITY_DOMAINS
|
||||
):
|
||||
return cast(
|
||||
ConfigType,
|
||||
await getattr(platform, DYNAMIC_VALIDATOR[automation_type])(hass, config),
|
||||
)
|
||||
|
||||
# Only call the dynamic validator if the referenced device exists and the relevant
|
||||
# config entry is loaded
|
||||
registry = dr.async_get(hass)
|
||||
|
||||
Reference in New Issue
Block a user