From 66f65d6a945d7ceaf85d451b695fce4b999738ea Mon Sep 17 00:00:00 2001
From: DubhAd
Date: Tue, 5 Feb 2019 19:57:01 +0000
Subject: [PATCH] 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.
---
source/_docs/automation/trigger.markdown | 26 +++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/source/_docs/automation/trigger.markdown b/source/_docs/automation/trigger.markdown
index 090c754ede4..1ce1f869139 100644
--- a/source/_docs/automation/trigger.markdown
+++ b/source/_docs/automation/trigger.markdown
@@ -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.
+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'
```