Skip to content

Commit e873345

Browse files
cdce8pfabaff
authored andcommitted
Script - wait_template 'trigger.entity_id' support (home-assistant#3593)
* * Updated wait_template to include 'trigger.entity_id' and 'variables' support * * Deleted notes and whitespaces * Small grammar correction
1 parent 8791e6e commit e873345

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

source/_docs/scripts.markdown

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,28 @@ wait_template: {% raw %}"{{ states.climate.kitchen.attributes.valve < 10 }}"{% e
9090
timeout: 00:01:00
9191
```
9292

93+
When using `wait_template` within an automation `trigger.entity_id` is supported for `state`, `numeric_state` and `template` triggers, see also [Available-Trigger-Data](/docs/automation/templating/#available-trigger-data).
94+
95+
{% raw %}
96+
```yaml
97+
wait_template: "{{ is_state(trigger.entity_id, 'on') }}"
98+
```
99+
{% endraw %}
100+
101+
It is also possible to use dummy variables, e.g., in scripts, when using `wait_template`.
102+
103+
{% raw %}
104+
```yaml
105+
# Service call, e.g. from an automation.
106+
service: script.do_something
107+
data_template:
108+
dummy: "{{ input_boolean.switch }}"
109+
110+
# Inside the script
111+
wait_template: "{{ is_state(dummy, 'off') }}"
112+
```
113+
{% endraw %}
114+
93115
### {% linkable_title Fire an Event %}
94116

95117
This action allows you to fire an event. Events can be used for many things. It could trigger an automation or indicate to another component that something is happening. For instance, in the below example it is used to create an entry in the logbook.

0 commit comments

Comments
 (0)