mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-28 03:37:06 +00:00
Document automation trigger ID template variables (#18497)
This documents the trigger IDs and index variables available in trigger_data for all trigger platforms (https://github.com/home-assistant/core/blob/master/homeassistant/helpers/trigger.py#L79) which was mentioned in the [2021.7 release notes](https://www.home-assistant.io/blog/2021/07/07/release-20217/#trigger-conditions-and-trigger-ids).
This commit is contained in:
parent
4e6c9d8262
commit
e4dade1b29
@ -9,6 +9,15 @@ Automations support [templating](/docs/configuration/templating/) in the same wa
|
|||||||
|
|
||||||
The following tables show the available trigger data per platform.
|
The following tables show the available trigger data per platform.
|
||||||
|
|
||||||
|
### All
|
||||||
|
|
||||||
|
The following describes trigger data associated with all platforms.
|
||||||
|
|
||||||
|
| Template variable | Data |
|
||||||
|
| ---- | ---- |
|
||||||
|
| `trigger.id` | Optional trigger `id`, or index of the trigger.
|
||||||
|
| `trigger.idx` | Index of the trigger.
|
||||||
|
|
||||||
### Event
|
### Event
|
||||||
|
|
||||||
| Template variable | Data |
|
| Template variable | Data |
|
||||||
@ -113,12 +122,15 @@ automation:
|
|||||||
trigger:
|
trigger:
|
||||||
- platform: state
|
- platform: state
|
||||||
entity_id: device_tracker.paulus
|
entity_id: device_tracker.paulus
|
||||||
|
id: paulus_device
|
||||||
action:
|
action:
|
||||||
- service: notify.notify
|
- service: notify.notify
|
||||||
data:
|
data:
|
||||||
message: >
|
message: >
|
||||||
Paulus just changed from {{ trigger.from_state.state }}
|
Paulus just changed from {{ trigger.from_state.state }}
|
||||||
to {{ trigger.to_state.state }}
|
to {{ trigger.to_state.state }}
|
||||||
|
|
||||||
|
This was triggered by {{ trigger.id }}
|
||||||
|
|
||||||
automation 2:
|
automation 2:
|
||||||
trigger:
|
trigger:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user