Time offsets

After many hours of puzzling over my non working automations i found that even an automation configured from the UI didn’t work. Getting up on morning I found a light on. I knew I hadn’t left it on, and reviewed the logs. It came on at 04:11am. Looking down my (test only) automation I found I had set that light to come on at 16:11 - clearly the system is not working in LOCAL TIME ZONE for automations. During configuration I have set the location data correctly - it knows where I live - and has told me the time zone is set for Auckland New Zealand (correct) . What have I missed setting the time zone?

Are you running in a VM?

If so, is the host system clock and time zone set correctly?

Running on R-Pi4 32Gb SD connected to ethernet & modem, and ‘standard’ config. Modbus integration used.

Can you post the result of this when pasted in Developer Tools → Templates:

{{ utcnow() }}
{{ now() }}
{{ utcnow().astimezone() }}
{{ now().astimezone() }}
{{ utcnow().tzinfo }}
{{ now().tzinfo }}
{{ now().astimezone().tzinfo }}
1 Like

HiTom,
Posted and waited for update, which happened to be quite soon.
Result was:
2022-08-31 07:00:00.002307+00:00
2022-08-31 07:00:00.002473+00:00
2022-08-31 19:00:00.002590+12:00
2022-08-31 19:00:00.002924+12:00
UTC
UTC
NZST
Thank you for the help.

Ok. There’s something wrong with your system time, the result of {{ now() }} should be:
2022-08-31 07:00:00.002473+12:00 not 2022-08-31 07:00:00.002473+00:00

Try rebooting the host, Settings → System → Hardware → ⋮ → Reboot Host

Then run the developer tools test again.

Hmmmmn… the result looks the same to me…
2022-08-31 08:26:00.002002+00:00
2022-08-31 08:26:00.002169+00:00
2022-08-31 20:26:00.002288+12:00
2022-08-31 20:26:00.002657+12:00
UTC
UTC
NZST

And you are 100% sure your Settings → General has the correct time zone?

If so try this at the command line:

ha core rebuild

It will reinstall the current version of Home Assistant. You won’t lose anything. It’s like doing an update, just of the same version.

Then once that has finished try the dev tools test again.

Hi Tom,

Just checked setting - time zone and it appeared to be totally UNSET - no value displayed.
I expect this is the reason well done you! I don’t know how it can became unset as I haven’t tried to adjust it before. This is good as it will auto adjust for daylight saving now Thank you very much for your help.
problem solved.

1 Like

I did not ask you to check that earlier because you said this:

Glad you got it sorted.

O.K yes, it’s been a while since I did the initial set-up, but I’m certain I saw Auckland set as time zone and the system was still reporting the correct lat and long, so I ASSUMED the time zone was still Auckland.
Just shows NEVER ASSUME eh?
Thank you again.

1 Like