NTP issues

I run HA Os on a RPI4.

I switched from domoticz a couple of months ago and I love HA.

The only thing that drives me crazy is NTP syncing. I have power and internet outages every day and everytime that happens the HAOS time is out of sync.

I did not have this problem with domoticz and my shelly devices around the house also don’t have that problem as they all sync fine straight after boot.

So in my opinion this is a software issue. I installed the chrony add on to sync the system time but even that addon does not work after a boot. It is started fine but I need to restart the time in order to sync the system time. After that I need to reboot HAOS otherwise my Tuya integration does not work.

Lots of unnecessary trouble.

So please can we add the following to system settings:

  • change or add ntp server
  • Button to manually sync system time + log output

NTP servers are already entered in HA, and there are many, not only one, you only need to choose time zone.

But i would strongly suggest that you solve power problems. Cutting power to Pi often is just calling for problems. Linux doesn’t like that at all (which HA OS basically is). System must shut down cleanly or you will experience file corruption very soon in a way that HA won’t start at all. Having a non-started addon after power restore confirms that.

It shouldn’t be too difficult to set up some sort of UPS for Pi: First hit on aliexpress

I bet you could even make system in a way that HA will cleanly shut down if batteries will become empty…

Thanks!

I will look at that

Besides of solving the power problems as Pavel had suggested above consider to add a high-precision RTC DS3231 module to your RPI4.

The problem with RPIs before the RPI5 is the lack of a Real Time Clock (RTC). Whenever you have a power outage your Pi forgets the (real-)time (this is what you are experiencing).

A RPI-compatible RTC DS3231 module is very cheap and basically just plug-and-play to get it working:

  • Plug it into the correct GPIO header pins of your RPI,
  • Add dtoverlay=i2c-rtc,ds3231 to config.txt,
  • Reboot → done.

For more in-depth instructions look HERE.

2 Likes

RTC module is a best solution. It will allow to boot with proper time even during Internet outagee.
As well then by using Chrony You can provide time to other devices, like shelly, etc.
Cause Chrony main function is an NTP server, not NTP client, IMHO.

1 Like

This is an excellent idea. In fact I never thought about a clean shutdown but now I already implemented it. I read out the charge state of my solar batteries and when its about to be empty I shutdonw HAOS using an automation.

1 Like