Incorrect time in Home Assistant, time zone is set correctly though

Hi everybody,

can you please help me correct my settings to actually use to local time?

I run a Docker container, where I specified TZ=Europe/Berlin. On my configuration.yaml, I also have time_zone: Europe/Berlin.

However, let’s say I click vacuum.medusa on my Lovelace Dashboard, it’ll show the device as idle from some time until 13:22 (which is now, but it is actually 15:22 at the moment).

I changed the TZ value (both for the docker container, as well as in my configuration) to Europe/Amsterdam, as we share the same current time, thinking that, for some reason Europe/Berlin was not recognized. This was not the case. After restarting Home Assistant, I still got the wrong time.

The server my docker container runs on will display the correct time when I run date in the command line. When I run docker exec -it hass /bin/bash, then anter date, I also get the correct current time.

So why won’t the frontend work with the correct time?

Thank you in advance for your help :slight_smile:

Can you put it in configuration → general and remove it from yaml?

Screenshot from 2021-10-20 09-29-37

1 Like

Thank you @AllHailJ

I took it out of the yaml, but still cannot manually edit that part (guess I’ll have to remove other parts as well for this to work).

However! I noticed that this only occurs on my desktop browser! It looks fine when I access the Home Assistant Android App (= displays the correct time).

I get this on my user configuration:

It was 12:07 at the time, but the browser still states 10:07. When I browse there on my phone, it shows the correct time again. My initial thought was that there is something wrong with my local time on the PC, but this is not the case. My system clock shows the correct time, my tmux status bar as well, and the date command line output also has the correct value. ONLY Home Assistant inside the browser on the PC has the false time.

Can you go here and see what the geolocation is. I am wondering if you have the wrong home lat and long?

freegeoip.net.

Here is how you would setup the lat/long in configuration.yaml

homeassistant:
  name: Home
  latitude: 32.87336
  longitude: 117.22743
  elevation: 430
  unit_system: metric

here is the basic configuration:

https://www.home-assistant.io/docs/configuration/basic/

I’m having the same problem, have you been able to fix it?

1 Like

my frontend getting wrong time also… is this 10.6 issue ?

I have this problem too a similar problem on 1 device, an Android system using the companion app.
Everything seems to be correct but from the logbook, events are 2 hours earlier.

Unfortunately, not yet. Times are fine on mobile, but two hours behind on any desktop browser.

I have had this issue for ages, just never found the time to do anything about it. This did not just start with 10.6

Seems to be browser problem. I tried Chrome, Edge no issue. Android app is fine too. Only Firefox giving wrong clock

Thanks for testing those other browsers @tyjtyj

Look at this; I just tried it (the javascript snippet), and that seems to be the cause!!

I am not going to change my privacy.resistFingerprinting, but I believe that should do it.

1 Like

I opened bug report

and later found related bug reported

1 Like

At the risk of doubling up, I’ve opened a bug report too. Useful if others could add any additional detail they have.

I’ve made mine broader than just Firefox as I’ve replicated this issue on other devices and browsers. I’ve been told that its a known issue and that the most recent Beta release fixes it - but in my testing the issue persists.

1 Like

This happened to me, but it was getting the time from my vpn connection, not my local computer.

1 Like

Home Assistant seems to report everything in UTC regardless of selected timezone, which seems to be the case here (since Berlin is +02:00). Wherever you can use templates, you can convert datetime strings to datetime objects and then to your local timezone using as_datetime and astimezone():

{{ as_datetime('DatetimeStringHere').astimezone() }}

Hope this helps!

2 Likes

I use this addon to fix the time:

I could not find an addon where you can choose on which site you want to change the time.