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:
akasma74 2020-03-16 12:02:11 +00:00 committed by GitHub
parent 877cf6922f
commit 6cbe897a2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -288,7 +288,7 @@ As an alternative, providing you include the sensor [time](/integrations/time_da
automation:
trigger:
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 %}