Fix ZHA regressions caused by "Support async validation of device trigger" (#27401)
* Revert "Support async validation of device trigger (#27333)"
This reverts commit fdf4f398a7
.
* Revert only ZHA changes
* Fix whitespace
* Restore ZHA changes but add check to make sure ZHA is loaded
* Address review comment
* Remove additional check
pull/27655/head
parent
2295b33204
commit
c7bd0fe909
|
@ -25,14 +25,14 @@ async def async_validate_trigger_config(hass, config):
|
||||||
"""Validate config."""
|
"""Validate config."""
|
||||||
config = TRIGGER_SCHEMA(config)
|
config = TRIGGER_SCHEMA(config)
|
||||||
|
|
||||||
trigger = (config[CONF_TYPE], config[CONF_SUBTYPE])
|
if "zha" in hass.config.components:
|
||||||
zha_device = await async_get_zha_device(hass, config[CONF_DEVICE_ID])
|
trigger = (config[CONF_TYPE], config[CONF_SUBTYPE])
|
||||||
|
zha_device = await async_get_zha_device(hass, config[CONF_DEVICE_ID])
|
||||||
if (
|
if (
|
||||||
zha_device.device_automation_triggers is None
|
zha_device.device_automation_triggers is None
|
||||||
or trigger not in zha_device.device_automation_triggers
|
or trigger not in zha_device.device_automation_triggers
|
||||||
):
|
):
|
||||||
raise InvalidDeviceAutomationConfig
|
raise InvalidDeviceAutomationConfig
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue