mirror of
https://github.com/home-assistant/core.git
synced 2025-05-30 10:47:06 +00:00
Fix ZHA regressions caused by "Support async validation of device trigger" (#27401)
* Revert "Support async validation of device trigger (#27333)" This reverts commit fdf4f398a79e775e11dc9fdd391a8b53f7b773c5. * Revert only ZHA changes * Fix whitespace * Restore ZHA changes but add check to make sure ZHA is loaded * Address review comment * Remove additional check
This commit is contained in:
parent
2295b33204
commit
c7bd0fe909
@ -25,14 +25,14 @@ async def async_validate_trigger_config(hass, config):
|
||||
"""Validate config."""
|
||||
config = TRIGGER_SCHEMA(config)
|
||||
|
||||
trigger = (config[CONF_TYPE], config[CONF_SUBTYPE])
|
||||
zha_device = await async_get_zha_device(hass, config[CONF_DEVICE_ID])
|
||||
|
||||
if (
|
||||
zha_device.device_automation_triggers is None
|
||||
or trigger not in zha_device.device_automation_triggers
|
||||
):
|
||||
raise InvalidDeviceAutomationConfig
|
||||
if "zha" in hass.config.components:
|
||||
trigger = (config[CONF_TYPE], config[CONF_SUBTYPE])
|
||||
zha_device = await async_get_zha_device(hass, config[CONF_DEVICE_ID])
|
||||
if (
|
||||
zha_device.device_automation_triggers is None
|
||||
or trigger not in zha_device.device_automation_triggers
|
||||
):
|
||||
raise InvalidDeviceAutomationConfig
|
||||
|
||||
return config
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user