Time zone set, but difference of 3600 s

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).

{{ 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?

Home Assistant normally stores all datetimes in UTC.

Very important information. I just changed some of my scripts.

Thanks