Simplifying the for: section (#8416)

The `for:` piece can be confusing for folks, providing the examples as human readable time, and mentioning that days and milliseconds are also supported.
This commit is contained in:
DubhAd 2019-02-05 19:57:01 +00:00 committed by Alok Saboo
parent 91472b1889
commit 66f65d6a94

View File

@ -73,7 +73,7 @@ automation:
above: 17
below: 25
# If given, will trigger when condition has been for X time.
# If given, will trigger when condition has been for X time, can also use days and milliseconds.
for:
hours: 1
minutes: 10
@ -86,6 +86,25 @@ Listing above and below together means the numeric_state has to be between the t
In the example above, a numeric_state that goes to 17.1-24.9 (from 17 or below, or 25 or above) would fire this trigger.
</p>
The `for:` can also be specified as `HH:MM:SS` like this:
{% raw %}
```yaml
automation:
trigger:
platform: numeric_state
entity_id: sensor.temperature
# Optional
value_template: '{{ state.attributes.battery }}'
# At least one of the following required
above: 17
below: 25
# If given, will trigger when condition has been for X time.
for: '01:10:05'
```
{% endraw %}
### {% linkable_title State trigger %}
Triggers when the state of a given entity changes. If only `entity_id` is given trigger will activate for all state changes, even if only state attributes change.
@ -101,10 +120,7 @@ automation:
to: 'home'
# If given, will trigger when state has been the to state for X time.
for:
hours: 1
minutes: 10
seconds: 5
for: '01:10:05'
```
<p class='note warning'>