mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 04:50:05 +00:00
Reorg device automation (#26880)
* async_trigger -> async_attach_trigger * Reorg device automations * Update docstrings * Fix types * Fix extending schemas
This commit is contained in:
@@ -24,7 +24,9 @@ TRIGGER_SCHEMA = vol.Schema(
|
||||
)
|
||||
|
||||
|
||||
async def async_trigger(hass, config, action, automation_info):
|
||||
async def async_attach_trigger(
|
||||
hass, config, action, automation_info, *, platform_type="event"
|
||||
):
|
||||
"""Listen for events based on configuration."""
|
||||
event_type = config.get(CONF_EVENT_TYPE)
|
||||
event_data_schema = (
|
||||
@@ -47,7 +49,7 @@ async def async_trigger(hass, config, action, automation_info):
|
||||
|
||||
hass.async_run_job(
|
||||
action(
|
||||
{"trigger": {"platform": "event", "event": event}},
|
||||
{"trigger": {"platform": platform_type, "event": event}},
|
||||
context=event.context,
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user