mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-24 09:46:59 +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.
|
||||
|
||||
### 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
|
||||
|
||||
| Template variable | Data |
|
||||
@ -113,12 +122,15 @@ automation:
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: device_tracker.paulus
|
||||
id: paulus_device
|
||||
action:
|
||||
- service: notify.notify
|
||||
data:
|
||||
message: >
|
||||
Paulus just changed from {{ trigger.from_state.state }}
|
||||
to {{ trigger.to_state.state }}
|
||||
|
||||
This was triggered by {{ trigger.id }}
|
||||
|
||||
automation 2:
|
||||
trigger:
|
||||
|
Loading…
x
Reference in New Issue
Block a user