Add this variable for use by automation and script templates (#18505)

This commit is contained in:
Richard T. Schaefer 2021-07-28 02:10:13 -05:00 committed by GitHub
parent c4ea5f7172
commit 29f6cba2a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -3,7 +3,13 @@ title: "Automation Trigger Variables"
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

View File

@ -247,6 +247,12 @@ script:
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 %}
### Waiting for Script to Complete