mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 15:26:59 +00:00
Add this variable for use by automation and script templates (#18505)
This commit is contained in:
parent
c4ea5f7172
commit
29f6cba2a6
@ -3,7 +3,13 @@ title: "Automation Trigger Variables"
|
|||||||
description: "List all available variables made available by triggers."
|
description: "List all available variables made available by triggers."
|
||||||
---
|
---
|
||||||
|
|
||||||
Automations support [templating](/docs/configuration/templating/) in the same way as scripts do. In addition to the [Home Assistant template extensions](/docs/configuration/templating/#home-assistant-template-extensions) available to scripts, the `trigger` template variable is available.
|
Automations support [templating](/docs/configuration/templating/) in the same way as scripts do. In addition to the [Home Assistant template extensions](/docs/configuration/templating/#home-assistant-template-extensions) available to scripts, the `trigger` and `this` template variables are available.
|
||||||
|
|
||||||
|
The template variable `this` is also available when evaluating any `trigger_variables` declared in the configuration.
|
||||||
|
|
||||||
|
## Available this Data
|
||||||
|
|
||||||
|
`this` is a state object. [State Objects](docs/configuration/state_object) provides a comprehensive description for the properties of `this` and `this.attributes`.
|
||||||
|
|
||||||
## Available Trigger Data
|
## Available Trigger Data
|
||||||
|
|
||||||
|
@ -247,6 +247,12 @@ script:
|
|||||||
message: "{{ message }}"
|
message: "{{ message }}"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<div class='note'>
|
||||||
|
|
||||||
|
Script variables that may be used by templates include those provided from the configuration, those that are passed when started from a service and the `this` variable whose value is a dictionary of the current script's state.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
### Waiting for Script to Complete
|
### Waiting for Script to Complete
|
||||||
|
Loading…
x
Reference in New Issue
Block a user