mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-20 15:56:51 +00:00
Update templating docs (#27107)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
b4bffdfb75
commit
d37d4be6de
@ -13,19 +13,25 @@ The variable `this` is the [state object](/docs/configuration/state_object) of t
|
|||||||
|
|
||||||
## Available Trigger Data
|
## Available Trigger Data
|
||||||
|
|
||||||
The following tables show the available trigger data per platform.
|
The variable `trigger` is an object that contains details about which trigger triggered the automation.
|
||||||
|
|
||||||
|
Templates can use the data to modify the actions performed by the automation or displayed in a message. For example, you could create an automation that multiple sensors can trigger and then use the sensor's location to specify a light to activate; or you could send a notification containing the friendly name of the sensor that triggered it.
|
||||||
|
|
||||||
|
Each [trigger platform](/docs/automation/trigger/#event-trigger) can include additional data specific to that platform.
|
||||||
|
|
||||||
### All
|
### All
|
||||||
|
|
||||||
The following describes trigger data associated with all platforms.
|
Triggers from all platforms will include the following data.
|
||||||
|
|
||||||
| Template variable | Data |
|
| Template variable | Data |
|
||||||
| ---- | ---- |
|
| ---- | ---- |
|
||||||
| `trigger.id` | Optional trigger `id`, or index of the trigger.
|
| `trigger.id` | The [`id` of the trigger](/docs/automation/trigger/#trigger-id).
|
||||||
| `trigger.idx` | Index of the trigger. (The first trigger idx is `0`.)
|
| `trigger.idx` | Index of the trigger. (The first trigger idx is `0`.)
|
||||||
|
|
||||||
### Calendar
|
### Calendar
|
||||||
|
|
||||||
|
These are the properties available for a [Calendar trigger](/docs/automation/trigger/#calendar-trigger).
|
||||||
|
|
||||||
| Template variable | Data |
|
| Template variable | Data |
|
||||||
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
|
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `trigger.platform` | Hardcoded: `calendar` |
|
| `trigger.platform` | Hardcoded: `calendar` |
|
||||||
@ -41,6 +47,8 @@ The following describes trigger data associated with all platforms.
|
|||||||
|
|
||||||
### Device
|
### Device
|
||||||
|
|
||||||
|
These are the properties available for a [Device trigger](/docs/automation/trigger/#device-trigger).
|
||||||
|
|
||||||
Inherites template variables from [event](#event) or [state](#state) template based on the type of trigger selected for the device.
|
Inherites template variables from [event](#event) or [state](#state) template based on the type of trigger selected for the device.
|
||||||
|
|
||||||
| Template variable | Data |
|
| Template variable | Data |
|
||||||
@ -49,6 +57,8 @@ Inherites template variables from [event](#event) or [state](#state) template ba
|
|||||||
|
|
||||||
### Event
|
### Event
|
||||||
|
|
||||||
|
These are the properties available for a [Event trigger](/docs/automation/trigger/#event-trigger).
|
||||||
|
|
||||||
| Template variable | Data |
|
| Template variable | Data |
|
||||||
| ---- | ---- |
|
| ---- | ---- |
|
||||||
| `trigger.platform` | Hardcoded: `event`.
|
| `trigger.platform` | Hardcoded: `event`.
|
||||||
@ -58,6 +68,8 @@ Inherites template variables from [event](#event) or [state](#state) template ba
|
|||||||
|
|
||||||
### MQTT
|
### MQTT
|
||||||
|
|
||||||
|
These are the properties available for a [MQTT trigger](/docs/automation/trigger/#mqtt-trigger).
|
||||||
|
|
||||||
| Template variable | Data |
|
| Template variable | Data |
|
||||||
| ---- | ---- |
|
| ---- | ---- |
|
||||||
| `trigger.platform` | Hardcoded: `mqtt`.
|
| `trigger.platform` | Hardcoded: `mqtt`.
|
||||||
@ -68,6 +80,8 @@ Inherites template variables from [event](#event) or [state](#state) template ba
|
|||||||
|
|
||||||
### Numeric State
|
### Numeric State
|
||||||
|
|
||||||
|
These are the properties available for a [Numeric State trigger](/docs/automation/trigger/#numeric-state-trigger).
|
||||||
|
|
||||||
| Template variable | Data |
|
| Template variable | Data |
|
||||||
| ---- | ---- |
|
| ---- | ---- |
|
||||||
| `trigger.platform` | Hardcoded: `numeric_state`
|
| `trigger.platform` | Hardcoded: `numeric_state`
|
||||||
@ -80,6 +94,8 @@ Inherites template variables from [event](#event) or [state](#state) template ba
|
|||||||
|
|
||||||
### State
|
### State
|
||||||
|
|
||||||
|
These are the properties available for a [State trigger](/docs/automation/trigger/#state-trigger).
|
||||||
|
|
||||||
| Template variable | Data |
|
| Template variable | Data |
|
||||||
| ---- | ---- |
|
| ---- | ---- |
|
||||||
| `trigger.platform` | Hardcoded: `state`
|
| `trigger.platform` | Hardcoded: `state`
|
||||||
@ -90,6 +106,8 @@ Inherites template variables from [event](#event) or [state](#state) template ba
|
|||||||
|
|
||||||
### Sun
|
### Sun
|
||||||
|
|
||||||
|
These are the properties available for a [Sun trigger](/docs/automation/trigger/#sun-trigger).
|
||||||
|
|
||||||
| Template variable | Data |
|
| Template variable | Data |
|
||||||
| ---- | ---- |
|
| ---- | ---- |
|
||||||
| `trigger.platform` | Hardcoded: `sun`
|
| `trigger.platform` | Hardcoded: `sun`
|
||||||
@ -98,6 +116,8 @@ Inherites template variables from [event](#event) or [state](#state) template ba
|
|||||||
|
|
||||||
### Template
|
### Template
|
||||||
|
|
||||||
|
These are the properties available for a [Template trigger](/docs/automation/trigger/#template-trigger).
|
||||||
|
|
||||||
| Template variable | Data |
|
| Template variable | Data |
|
||||||
| ---- | ---- |
|
| ---- | ---- |
|
||||||
| `trigger.platform` | Hardcoded: `template`
|
| `trigger.platform` | Hardcoded: `template`
|
||||||
@ -108,6 +128,8 @@ Inherites template variables from [event](#event) or [state](#state) template ba
|
|||||||
|
|
||||||
### Time
|
### Time
|
||||||
|
|
||||||
|
These are the properties available for a [Time trigger](/docs/automation/trigger/#time-trigger).
|
||||||
|
|
||||||
| Template variable | Data |
|
| Template variable | Data |
|
||||||
| ---- | ---- |
|
| ---- | ---- |
|
||||||
| `trigger.platform` | Hardcoded: `time`
|
| `trigger.platform` | Hardcoded: `time`
|
||||||
@ -115,6 +137,8 @@ Inherites template variables from [event](#event) or [state](#state) template ba
|
|||||||
|
|
||||||
### Time Pattern
|
### Time Pattern
|
||||||
|
|
||||||
|
These are the properties available for a [Time Pattern trigger](/docs/automation/trigger/#time-pattern-trigger).
|
||||||
|
|
||||||
| Template variable | Data |
|
| Template variable | Data |
|
||||||
| ---- | ---- |
|
| ---- | ---- |
|
||||||
| `trigger.platform` | Hardcoded: `time_pattern`
|
| `trigger.platform` | Hardcoded: `time_pattern`
|
||||||
@ -122,6 +146,8 @@ Inherites template variables from [event](#event) or [state](#state) template ba
|
|||||||
|
|
||||||
### Webhook
|
### Webhook
|
||||||
|
|
||||||
|
These are the properties available for a [Webhook trigger](/docs/automation/trigger/#webhook-trigger).
|
||||||
|
|
||||||
| Template variable | Data |
|
| Template variable | Data |
|
||||||
| ---- | ---- |
|
| ---- | ---- |
|
||||||
| `trigger.platform` | Hardcoded: `webhook`
|
| `trigger.platform` | Hardcoded: `webhook`
|
||||||
@ -132,6 +158,8 @@ Inherites template variables from [event](#event) or [state](#state) template ba
|
|||||||
|
|
||||||
### Zone
|
### Zone
|
||||||
|
|
||||||
|
These are the properties available for a [Zone trigger](/docs/automation/trigger/#zone-trigger).
|
||||||
|
|
||||||
| Template variable | Data |
|
| Template variable | Data |
|
||||||
| ---- | ---- |
|
| ---- | ---- |
|
||||||
| `trigger.platform` | Hardcoded: `zone`
|
| `trigger.platform` | Hardcoded: `zone`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user