Internet Connection lost - Hub never reconnects

Patrick is there a way to set the NTP server for those instances where we want to run a hub offline to keep the clock synced with a Windows machine on our network or was the clock drift caused by something else that shouldn't be an issue in this case?

Thanks.

Not built in. I'm sure there are ways to redirect NTP traffic or update the time directly via the web action the hub uses to set time manually.

All clocks drift, some more than others, that's why NTP exists and why we allow updates via a browser button.

I am running AsusWRT-Merlin firmware on my Asus RT-AC86U router. In a recent Merlin firmware update, he added the ability to redirect all NTP requests directly to the router's built-in NTP time server. After doing this, and by having my HE hubs, router and network switches all on a small UPS, I have never had any time drift/clock updating issues. Of course, if my router gets rebooted, it still relies on the Internet NTP time servers! :wink:

2 Likes

Is the NTP server(s) in HE hub an IP address or name?

I believe name. But not 100%

Here is some previous information regarding NTP... FWIW... :wink:

@ogiewon I was just trying to think of other ways to redirect NTP. Routers that can redirect NTP are harder to find than routers that can redirect a name. I have a pretty powerful configurable router. I can do lots of redirecting traffic, but I can't touch redirecting port 123 to a local time server. It is, however, really easy add an entry to something as simple as a host file.
That all presumes that the Hubitat hub is using DNS servers handed out by the local DHCP server, which it probably doesn't. Just a thought.

Or you could just fire up something to POST to /location/updateTime with a body of a valid date time in this format 23 Aug 2019 11:23:53

And viola, your time is now set to that.

That's all the sync from browser button does.

Simple offline time sync via a local POST url.

Can be done via Tasker on Android pretty easily.

3 Likes

Very interesting idea!!! Is there also a way to read the current time or is that buried in the full html? This way we could create a script that reads the time and only updates it in case it is wrong..... Very simple bash/curl or NodeRed flow

1 Like

Thankful everyday for your recommendation on this every time I hear of NTP issues after updates come out.....

1 Like

Even if the hub is not using the DHCP supplied DNS server(s), some routers allow you trap the DNS requests and force them to use the DNS server of your choice. I remember doing this years ago to force all DNS traffic through OpenDNS when the kids were young...and I wanted to safeguard their web surfing.

Which version was there before 2.1.4? Was it 2.1.3.128?

I believe that it was 2.1.3.128

I finally setup the new C-5 hub I bought for my parents where they don't have internet access. After powering on the hub I had to sync time via the browser as it was way off but by the time I left about 9 hours later it's time was still close enough to not be able to notice any drift. By the next morning however it had lost at least 2 hours (maybe days as my dad didn't notice the date at that time) He resynced it then checked it late that night and it was still correct, by this morning at 9:26am the hub said it was August 3 2019 at 7:22am.

My guess is on reboots and nightly hub maintenance the hub tries to sync with NTP and if it can't it seems to reset the time to when the firmware was released?

I'd be fine with syncing the time from the browser occasionally to correct any minimal drift that might occur if it was off by a few minutes over a months time or more but creating a process to run on a Windows machine every night at 4am to correct this issue would just be a bandaid that not all users would be able to replicate.

I will in the meantime create the job to make the Hub usable for my parents if you can provide an example of how I can do this with an AT Job, would this require curl or can it just be an http command line? Also would having a hub security account enabled affect how this is handled?

Thanks.

Just to add info this morning the hub time was Aug 3 2019 2 hours behind CST time again. I plan to try the following Curl command to try to salvage this install this weekend, does this look right?
curl.exe -d "10 Sep 2019 09:26:39" -X POST http://192.168.23.21/location/updateTime

Hubitat is going to have to state "requires an internet connection" if they can't make the time stay OK for more than 1 day...

1 Like

Such a curious design decision to not include a battery RTC.

Well, they didn't design the hardware (although they did pick it, so not fully absolved :slight_smile: ).

The base hardware is used by a number of vendors (at least it was on the c-4 version).

I would GUESS that Hubitat would agree with you, though... An RTC being included would have been better.

wouldn't simply allowing a custom NTP server in the HE hub solve this without all these external hacks? All my IP cams allow custom NTP time server to keep in sync.

Yes, it largely would.

Hopefully that is on their 'to-do' list... I THINK they said it was, but I can't remember for sure.