Add template support to template trigger's for option (#9714)

This commit is contained in:
Phil Bruckner 2019-06-29 10:20:47 -05:00 committed by Franck Nijhof
parent 76fb9e7fdf
commit 8b83098a77

View File

@ -201,6 +201,21 @@ automation:
```
{% endraw %}
You can also use templates in the `for` option.
{% raw %}
```yaml
automation:
trigger:
platform: template
value_template: "{{ is_state('device_tracker.paulus', 'home') }}"
for:
minutes: "{{ states('input_number.minutes')|int(0) }}"
```
{% endraw %}
The `for` template(s) will be evaluated when the `value_template` becomes `true`.
<p class='note warning'>
Rendering templates with time (`now()`) is dangerous as trigger templates only update based on entity state changes.
</p>