Teach state trigger about entity registry ids (#60271)
* Teach state trigger about entity registry ids * Tweak * Add tests * Tweak tests * Fix tests * Resolve entity ids during config validation * Update device_triggers * Fix mistake * Tweak trigger validator to ensure we don't modify the original config * Add index from entry id to entry * Update scaffold * Pre-compile UUID regex * Address review comment * Tweak mock_registry * Tweak * Apply suggestion from code review
This commit is contained in:
parent
c0fb1bffce
commit
c85bb27d0d
20 changed files with 324 additions and 74 deletions
|
@ -11,8 +11,8 @@ from homeassistant.components.automation import (
|
|||
)
|
||||
from homeassistant.components.device_automation import DEVICE_TRIGGER_BASE_SCHEMA
|
||||
from homeassistant.components.homeassistant.triggers.state import (
|
||||
TRIGGER_SCHEMA as STATE_TRIGGER_SCHEMA,
|
||||
async_attach_trigger as async_attach_state_trigger,
|
||||
async_validate_trigger_config as async_validate_state_trigger_config,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE_ID,
|
||||
|
@ -67,7 +67,7 @@ async def async_attach_trigger(
|
|||
CONF_ENTITY_ID: config[CONF_ENTITY_ID],
|
||||
}
|
||||
|
||||
state_config = STATE_TRIGGER_SCHEMA(state_config)
|
||||
state_config = await async_validate_state_trigger_config(hass, state_config)
|
||||
return await async_attach_state_trigger(
|
||||
hass, state_config, action, automation_info, platform_type="device"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue