Skip to content

Commit 964b622

Browse files
pvizelifabaff
authored andcommitted
New core state track feature (home-assistant#3313)
* Update binary_sensor.template.markdown * Update trigger.markdown * Update trigger.markdown
1 parent c3736c2 commit 964b622

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

source/_components/binary_sensor.template.markdown

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Configuration variables:
3232
- **device_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
3333
- **value_template** (*Optional*): Defines a [template](/topics/templating/) to extract a value from the payload.
3434
- **entity_id** (*Optional*): Add a list of entity IDs so the sensor only reacts to state changes of these entities. This will reduce the number of times the sensor will try to update it's state.
35+
- **on_delay** (*Optional*): The amount of time the template state must be met before this sensor will switch to on.
36+
- **off_delay** (*Optional*): The amount of time the template state must be not met before this sensor will switch to off.
3537
3638
## {% linkable_title Examples %}
3739
@@ -110,6 +112,20 @@ sensor:
110112
icon_template: {% raw %}'{% if is_state("sun.sun", "above_horizon") %}mdi:weather-sunny{% else %}mdi:weather-night{% endif %}'{% endraw %}
111113
```
112114

115+
### {% linkable_title Washing Machine Running %}
116+
117+
This example creates a washing machine "load running" sensor by monitoring an energy meter connected to the washer. During the washer's operation, the energy meter will fluctuate wildly, hitting zero frequently even before the load is finished. By utilizing `off_delay`, we can have this sensor only turn off if there has been no washer activity for 5 minutes.
118+
119+
```yaml
120+
# Determine when the washing machine has a load running.
121+
binary_sensor:
122+
- platform: template
123+
name: Washing Machine
124+
value_template: {% raw %}'{{ sensor.washing_machine_power > 0 }}'{% endraw %}
125+
off_delay:
126+
minutes: 5
127+
```
128+
113129
### {% linkable_title Is anyone home? %}
114130

115131
This example is determining if anyone is home based on the combination

source/_docs/automation/trigger.markdown

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ automation:
6868
# At least one of the following required
6969
above: 17
7070
below: 25
71+
72+
# If given, will trigger when condition has been for X time.
73+
for:
74+
hours: 1
75+
minutes: 10
76+
seconds: 5
7177
```
7278

7379
<p class='note'>

0 commit comments

Comments
 (0)