SHowing time in UTC but timezone is correct

Sorry, I posted to another older forum before creating this one
Below is what I ran in template

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

By comparison I get

2019-08-05 02:26:16.915953+00:00
2019-08-05 14:26:16.916010+12:00
2019-08-05 14:26:16.916080+12:00
2019-08-05 14:26:16.916836+12:00
UTC
Pacific/Auckland
NZST

But I am NOT on hassio.

I used to get the correct details when I ran it a couple of months ago because of a different issues.
However since I moved to Hassos from Resin, the times are a bit all over the place.

SOme other people in the past had similar issues, and they said when they next upgraded to the new versions of Hassio, it fixed it,
I am not sure if I should downgrade and then see if it fixes, or wait till the next new version.

1 Like

I suspect there is some hangover from your resinos config has spilled over to hassos via that snapshot. I suggest to try and sort it you ssh in and you should be in the config directory. Then run

grep -i tz * -r
grep -i timezone * -r

That is 2 separate commands. It will look in config and all directories below it from the string tz (case insensitive) and then the string timezone.

This may isolate some setting that is tucked away somewhere.

You haven’t actually said what the problem is? HA does work in UTC but will convert to local - but not in the logs.(the standard HA log is local but the supervisor log is UTC. Last changed attribute is also normally UTC) Where are you seeing the problem?

The logs should read in localtime.

All linuxes/unixes run UTC at heart. I think windows does now too. However to the user they should display localtime through setting a timezone.

In most distros this is achieved by setting /etc/localtime to the timezone file for your area.

On hassio this is supposed to work through the configuration.yaml setting for timezone, ie the yaml setting is supposed to present everything in home assistant in localtime.

HI David
My issue is similar to one which you were imvolved with back in may

Essentially when running the commands

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

The 1st line should be in UTC, the rest in your local time zone. ALso the last one should also be in you r timezone. However they are both in UTC,
I only noticed since I had a template which shows when a sensor is last activate, and it was also showing it as last activity in the middle of the night. Also since the time is wrong, the BOM sensor which usually get information every 30 mins from my local station, is not updating anymore, unless I reboot.

Yeah mine does that as well… it’s showing last triggered here in UTC which is a PITA.
image
Clicking on it:
image
And using a template here:
image

Just an FYI if anyone is monitoring this thread. I just updated to 0.97 and it fixed up all my timezone issues. I thought it might since I saw another forum say an upgrade fixed it up.

Happy days :smiley:

1 Like

0.105 still this same issue

What is your timezone set to in configuration / general?

Does it matter really which one?

yes AFAIK it does

Warsaw
(really post must be at least 10 characters long?:wink:

This might not be your exact issue but I spent way too much time on something similar. Make sure the time zone of your client device is right. The datetimes shown in the frontend are offset to the time zone of your client.

My time zone on my tesla browser is always in UTC (I think it is connecting over a vpn).
Time zone in general is set to europe brussels.

Still my graphs are in utc as is sun rise etc…

homeassistant:
unit_system: metric
time_zone: “Europe/Brussels”
latitude: 51.0321064
longitude: 4.7371767
elevation: 14
currency: EUR
temperature_unit: C

Does anyone knows a work around to force home assistant to a different timezone (the correct zone)

thank you

With the new 2023.7, I believed it should be corrected (change the Time zone with Server time zone), but its not.

How could manage correct time zone for Tesla browser?

Any solution 2 years after?

This appears to be a Tesla issue doesn’t it? (I will test mine when I remember)

What exactly are you seeing, so I can compare.

All graph (apex chart for example) in my Tesla Browser are shown with San francisco time zone.