mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 07:17:14 +00:00
example updated (#12384)
There is no need in using as_timestamp as we can subtract datetimes and then use the resulting timedelta's total_seconds() I believe it's more intuitive and elegant
This commit is contained in:
parent
877cf6922f
commit
6cbe897a2c
@ -288,7 +288,7 @@ As an alternative, providing you include the sensor [time](/integrations/time_da
|
|||||||
automation:
|
automation:
|
||||||
trigger:
|
trigger:
|
||||||
platform: template
|
platform: template
|
||||||
value_template: "{{ (as_timestamp(states.sensor.time.last_changed) - as_timestamp(states.YOUR.ENTITY.last_changed)) > 300 }}"
|
value_template: "{{ (states.sensor.time.last_changed - states.YOUR.ENTITY.last_changed).total_seconds() > 300 }}"
|
||||||
```
|
```
|
||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user