Skip to content
Snippets Groups Projects
Commit c7bd0fe9 authored by Erik Montnemery's avatar Erik Montnemery Committed by David F. Mulcahey
Browse files

Fix ZHA regressions caused by "Support async validation of device trigger" (#27401)

* Revert "Support async validation of device trigger (#27333)"

This reverts commit fdf4f398.

* Revert only ZHA changes

* Fix whitespace

* Restore ZHA changes but add check to make sure ZHA is loaded

* Address review comment

* Remove additional check
parent 2295b332
Branches
Tags
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment