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:
David Beitey 2021-07-14 18:37:19 +10:00 committed by GitHub
parent 4e6c9d8262
commit e4dade1b29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: