I need to check a Z-Wave device, if the last update (not change) is more than 5 minutes.
{{ now().strftime("%s") |float - states.sensor.test.last_updated.strftime("%s")|float > 60*5 }}
However, the time difference is always greater than 3600 s an thus returns true
. Why is that?
I set the correct time zone in home assistant (Europe/Zurich).
123
(Taras)
2
{{ now() - states.sensor.test.last_updated > timedelta(minutes=5) }}
Check if it reports the correct time difference using this:
{{ now() - states.sensor.test.last_updated }}
1 Like
So, it does in fact always use UTC if I use %s
?
123
(Taras)
4
Home Assistant normally stores all datetimes in UTC.
Very important information. I just changed some of my scripts.
Thanks