Time sensor is off by 4:43

Was trying to figure out why all my sunset/sunrise automations had suddenly gone wonky. Then I noticed the time sensor it out of whack and seems to have been frozen!

Have rebooted HA but no help.

I don’t have any records of my automations being triggered (although I can see them being triggered).

Maybe it is the event logger that isn’t working?

Check Settings → System → Logs for errors.

I did. Some errors on fully-kiosk no longer being supported but nothing else sticks out.

Browser cache refresh?

You should definitely see errors relating to the database if your recorder had stopped working.

The only error messages that could be relevant are these, but they do not directly relate to the log service…

It smells like a timezone problem. If I look at my outside temperature sensor, it follows the expected profile except that the overnight low happens at around 2am instead of the actual 7am. The time on my laptop and the time on HA are off by 4:43

I made sure my TZ was set correct. Even changed it to a “bad” one and observed the time shift (but still 5 hours off)

And this makes it impossible to access my instance via the Nabu Casa app as the time difference invalidates the SSL handshake.

You should fix your base and internal url config. Though it is as you say unrelated.

Check NTP settings on your internet router.

I’ve logged on to my HA instance using SSH and manually set the time using the ‘date’ command and that seems to have fixed things.

Make sure that the NTP packets are allowed through your firewall both ways.
It is on port 123, but I can’t remember on which protocol. I think it is TCP.

Also make sure that if you run in a VM that the hypervisor provide a good RTC emulation.
Real Time Clock drift is a common problen in a hypervisor.

This instance has been running on the same in-home WiFi + routers for several months without any issues. Looks like the problem started when we had a power outage Sat morning.

My HA Pi4 is on a UPS and I shut it down cleanly. My router & modem are also on a (different) UPS and they didn’t go down.

How do I go about checking my NTP connectivity from my HA instance??

It seems to work just fine on my Mac:

% sntp pool.ntp.org
+0.067835 +/- 0.080452 pool.ntp.org 204.2.134.163

PIs have no RTC, so when you shuts it down it will lose all knowledge of time, whether it’s a clean or dirty shutdown does not matter.

Hence why it uses a NTP server to set its clock – which it seemed to have done without problems up until now.

How is that? You mentioned that your laptop is off time?! So I thought > Network issue.

How do you run HA?
On a raspberry? Did you set the local settings right?

Yes, and that’s how I solved my problem (by manually setting the time) but it always came up with the right time after a reboot, except those last few times.

My laptop has the correct time and can access NTP servers without problems.