mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-09 18:36:51 +00:00
Add template support to state trigger's for option (#9762)
This commit is contained in:
parent
3c080e9379
commit
c7e68622eb
@ -124,6 +124,27 @@ automation:
|
||||
for: '01:10:05'
|
||||
```
|
||||
|
||||
You can also use templates in the `for` option.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
automation:
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: device_tracker.paulus, device_tracker.anne_therese
|
||||
to: 'home'
|
||||
for:
|
||||
minutes: "{{ states('input_number.lock_min')|int }}"
|
||||
seconds: "{{ states('input_number.lock_sec')|int }}"
|
||||
action:
|
||||
service: lock.lock
|
||||
entity_id: lock.my_place
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
The `for` template(s) will be evaluated when an entity changes as specified.
|
||||
|
||||
|
||||
<p class='note warning'>
|
||||
Use quotes around your values for `from` and `to` to avoid the YAML parser interpreting values as booleans.
|
||||
</p>
|
||||
|
Loading…
x
Reference in New Issue
Block a user