The reasons for this project:
there are off-grid scenarios where you want HE but have no Internet service.
the HE hub does not include a battery-backed RTC (real time clock) and if NTP servers aren't immediately available over the Internet at the time you boot or reset the hub, the system can end up not knowing the correct time of day - result, your time-based modes, automations and rules don't run properly.
A strong marketing message and raison-detre of Hubitat is local execution, ie not relying on cloud services like other home automation platforms. However, dependency on internet NTP servers to set the time is one area where it is currently not purely local as billed.
Time is available from GPS satellites. A USB GPS receiver costs about $14. We can use this to set the time of a NTP server running on a raspberry pi or home router. Then we just need to have HE get its time from our now-synced ntp server.
My first attempt with this has been successful so far.
Im using a Mikrotik hAP lite router RB951, but you can use any Mikrotik router that has a USB port. The RB951 is around $41. I connected the VK-162 GPS device ($14) to the USB port of the router. I installed the extra GPS and NTP packages and rebooted.
I logged in with Mikrotik's winbox admin tool. I enabled the GPS and set the port to USB0, and bang - instantly, the Mikrotik set its system clock to the correct time. GPS hadn't even had time to sync up or get lock, and the puck is just sitting on my desk indoors, not near a window, no clear line of sight to the sky at all. I guess one of the first messages it gets from the birds is the time.
All good so far. Next I enabled the NTP server, I unchecked the options for broadcast, multicast and manycast as I didnt want possibly wrong time being sprayed all over my LAN. I put a static IP on it from my LAN, and went ahead and tested the server using the ntpdate -q command on a linux terminal. The ntp server correctly responds with the correct time, and it shows its at stratum 4, which should be plenty good enough for any client to set their time to.
The next step, which I have not yet fully tested with HE due to not having a dev HE hub to play with, is to set the Mikrotik router up as the dhcp, dns and ntp server for the HE. We can intercept the DNS requests coming from HE and respond to them with our own IP address.
So now HE is using us as its DNS server, and we just answer any request for pool.ntp.org with our own IP address.
So if you are planning to deploy HE at a off-grid location with no internet, you would still need to initially connect it to the internet in order to do the initial registration and on-boarding. You could build your Mikrotik router with the following config, and then take it to the site, connect HE to Mikrotik port 1 and it should just work.
/ip address add address=192.168.1.1/24 interface=ether1 /ip pool add name=dhcp_pool0 ranges=192.168.1.2 /ip dhcp-server add address-pool=dhcp_pool0 disabled=no interface=ether1 name=dhcp1 /ip dhcp-server network add address=192.168.1.0/24 gateway=192.168.1.1 /ip firewall nat add action=redirect chain=dstnat dst-port=53 protocol=udp /ip dns set allow-remote-requests=yes /ip dns static add address=192.168.1.1 name=pool.ntp.org /system gps set enabled=yes port=usb1 set-system-time=yes /system ntp server set enabled=yes manycast=no
This could all be done on a Raspberry Pi too with dnsmasq, chrony, gpsd etc, but, as they say, thats an exercise left up to the reader.
The Hubitat team could enable support for time syncing from USB GPS dongles (connected via a USB hub) in an update, and this would remove one more dependency on Internet/cloud.