SHowing time in UTC but timezone is correct

I upgraded from Resin to HassOS, by doing a snapshot and importing it in.
It mostly finished without any issues, however I did notice some of my times appear to be in UTC

Text

I ran the above script and got the below
2019-08-04 00:18:24.646504+00:00
2019-08-04 10:18:24.646602+10:00
2019-08-04 00:18:24.646759+00:00
2019-08-04 00:18:24.647025+00:00
UTC
Australia/Melbourne
UTC

Another interesting thing is that the home-assistant.log time stamp is also in UTC
Finally I checked on the console by running date and it showed the correct time and date
So there must be a setting I am missing somewhere.
I also tried to comment out the timezone to see if it would do an auto-detect, however that didn’t work either
Below is my confingatrion.yaml (the top part)
This worked fine when I was on the resin OS…

 # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: !secret home_latitude
  longitude: !secret home_longitude
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: !secret home_elevation
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: Australia/Melbourne
  # Customization file
  customize: !include customize.yaml
  packages: !include_dir_named packages

Does anyone have any advise on where to start looking for this setting.

How many times have you rebooted?

I have rebooted probably about 3 or 4 times. Full OS reboot as well as just HA reboot

Just did another reboot… no luck

Yeah I think that will be enough!!

HI ALl
I have done some more googling and have had a look at the docker containers for both homeassistant & hassos_supervisor.
Both appear to be in UTC time. I am trying to find out if this is correct or not.
Also if there is a way to change the time to the correct zone

What is the “above script”?

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