Wrong time (not time zone) in Home Assistant OS

I’ve searched quite a bit in the forum but everyone seems to have problems with the time zone.

Trying to print

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

I get the following:

I am in Italy, so the time zone is correct. As you can see, the problem isn’t the time zone also because the minutes are shifted.

What could I try to do to solve the problem?

System Health

version 2021.1.5
installation_type Home Assistant OS
dev false
hassio true
docker true
virtualenv false
python_version 3.8.7
os_name Linux
os_version 5.4.79-v8
arch aarch64
timezone Europe/Rome
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 4930
Installed Version 1.10.1
Stage running
Available Repositories 709
Installed Repositories 7
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Hass.io
host_os Home Assistant OS 5.10
update_channel stable
supervisor_version 2021.01.7
docker_version 19.03.13
disk_total 57.8 GB
disk_used 41.7 GB
healthy true
supported true
board rpi4-64
supervisor_api ok
version_api ok
installed_addons ***
Lovelace
dashboards 1
mode storage
views 10
resources 7

I have reinstalled HA from scratch and restored a snapshot (only folders and add-ons) and now it’s even worse:

2020-12-16 18:56:00.011686+01:00
2020-12-16 18:56:00.011872+01:00
2020-12-16 18:56:00.012214+01:00
2020-12-16 18:56:00.012586
2020-12-16 18:56:00.013597
2020-12-16 17:56:00.013944
2020-12-16 17:56:00.014029+00:00
Europe/Rome
CET
UTC

I also had to disable 2FA because I couldn’t access with the OTP (since time is completely shifted).

Solved by setting a “custom” NTP configuration. I say “custom” because I just put the default one that HA should use, that for some reason wasn’t used.

These are the steps that I followed:

  1. Format a USB stick with FAT32 (EXT4 and NTFS should work too) and call it CONFIG
  2. Create a file named timesyncd.conf
  3. Write the following:
[Time]
NTP=time1.google.com time2.google.com time3.google.com
FallbackNTP=0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org
  1. Restart the Raspberry (I tried restarting HA but it didn’t work, so I just turned off and on the Raspberry [read the note])

Note: you shouldn’t turn off the Raspberry with HA running because it may corrupt the SD card, so use other methods or do a backup before doing it.

3 Likes

I have this same problem but I’m running HA from a VirtualBox VM on macos. Any idea how to set a custom NTP configuration on a VM…?

hi,
i’m in the same situation. have you solved?

long story: just migrated from raspberry pi 3B to Ubuntu VM running on an Intel NUC with windows 10 and VirtualBox.
I started from a fresh installation following the instructions from TheHookUp outube video and then restored the full snapshot.
Everyting seems ok except the multifactor authentication that I disabled before creating the snapshot from raspberry instance.

Now I’m trying to enable again the MFA (perfectly working on raspberry) in the new instance but the association with Google Authenticator doesn’t work due to some kind of issue with time settings.
My new home assistant instance shows the correct timezone and time in logs but if I open the cli and type “date” i get the UTC time (the correct time here in Italy now is UCT+2).

just solved the easiest way: force sync in google authenticator app.
doing this, i could enable again the MFA.