Why does my ESPHome clock keep showing the wrong time after a day or so?

Oct 23, 2026 Last reply: 2 days ago 5 Replies

First reply

slate_knot_1987

The clock drift is almost certainly happening because the device is relying too much on its internal oscillator rather than consistent network synchronization. Even if it maintains a solid WiFi connection, the internal Real-Time Clock chip on the ESP board itself isn't designed…

Read the full reply

So I put togehter one of those little DIY ESP clocks everyone's been talking about and for the most part it works. Display looks great, Home Assistant sees it, I even got a couple of automations tied to it so the screen dims at night. The problem is the time itself. It's fine right after a reboot but after a day or so it drifts by a few minutes and I have no clue why.



I thougth these things were supposed to pull the time from the network? I added the time component with my Home Assistant server as the source and set it to update every so often, but it still seems to wander. My router shows the little guy staying connected the whole time so it's not dropping off wifi as far as I can tell. Could it be a deep sleep thing or something with how often it checks in? Honestly not sure what logs to even look at first. Also is it normal for the brightness sensor to be super jumpy? Mine flickers between two levels every time the kitchen light goes on and off and it's kind of annoying. Would love to hear how you all smoothed that out if it's a common thing.


The clock drift is almost certainly happening because the device is relying too much on its internal oscillator rather than consistent network synchronization. Even if it maintains a solid WiFi connection, the internal Real-Time Clock chip on the ESP board itself isn't designed to keep perfect time when the power is fluctuating or when the chip is doing heavy processing elsewhere. Once it loses contact with the time server, it starts drifting, and if you don't force a re-sync, the error just piles up untill the next successful check. Try forcing the NTP component to update its time every hour instead of once a day, or if that fails, check if your specific ESP chip supports a battery backed RTC and use that method instead.

Regarding the drift itself, if the component is configured to check in, it should be doing so reliably. If you are using the standard NTP component, you might have the update interval set to something like ten hours, which just isn't precise enough for a clock. Increasing that update frequency is the easiest fix. Also, look through the logs during a time when the drift is apparent; if you see massive jumps in the reported time, that suggests a transient network issue is causing a bad time sync instead of a steady drift.

As for the jumpiness of the brightness sensor, that is extremely common. Sensors are noisy. They are measuring instantaneous light changes, and since you are in a kitchen, every little ripple of light from a passing car or a turning appliance will cause the raw reading to jump. Your automation is likely reacting to these rapid, momentary spikes instead of the overall light level.

The fix for the sensor jitter is to add some logic to filter the input. Instead of reacting to the raw sensor value, you should introduce an average filter in ESPHome, perhaps taking ten consecutive readings over a minute and only then passing that averaged value to Home Assistant. Alternatively, in your Home Assistant automation, you need to implement hysteresis or a deadband. For example, don't turn the light on until the sensor reading is above 500 lux, and don't turn it off until the reading drops below 400 lux, giving it a stable range to operate within.

I've seen this with the clock drift before, and it often isn't a network thing. Sometimes the problem is just the power supply stability. If there's even a slight dip in voltage on the 5V rail, it can mess up the crystal oscillator timing, even if it looks connected. You might wanna check the power lead connection to make sure it's solid. For the jittery sensor, instead of filtering, try just running the sensor update loop slower. Rapid sampling just feeds you more noise than you need.

For the sensor jumpiness, my experience has been that the ESPHome filter can be really aggressive. Instead of averaging over a minute, I set the input component to only report a value if it's changed more than twenty percent since the last successful reading. That stopped the flickering almost immediately. It makes the transitions feel sluggish, but you get a much steadier signal. For the time issue, if you are using the standard NTP setup, I recommend adding a manual check on startup just in case the device was unplugged for a while. That gives it a reliable sync before it starts running off the crystal.

I totally agree that the clock drift is often tied to power supply stability. I had this exact issue with an earlier clock project and it wasn't the network at all. I noticed the time would just start jumping randomly after a week of stable power. The fix was bringing the power adapter directly from a known clean outlet rather than running it through the whole power strip. That stable voltage kept the time crystal chip running accurate. It's a small thing, but it makes a huge difference in these builds.

Update: the power supply thing was probaly part of it. Swapped in a diferent adapter and the drift slowed way down, though it still loses a bit after a few days. Also tried the change-more-than-twenty-percent idea for the light sensor and the flickering is basially gone. So now, how often are you all setting the resync interval for the time component?

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required