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?
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!
@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.
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
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.
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?
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
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.