NTP Client / Local NTP Server support

I used a small puck antenna, with about a 6ft tail. My pi GPS receiver has an UFL connection that I used a ufl to SMA adapter on. The pi is in the basement a few feet from a basement window, and the puck just sits on the sill there. Seems to work well.

S.

My antenna is on the window sill (inside the house), too. Worked fine, locked gps sync quickly.

I would love to see both static IP and NTP configuration options. However, on the NTP front I might settle for HE paying attention to the NTP options provided by DHCP. :slight_smile:

1 Like

Yeah, respecting DHCP NTP config would be nice.

But at least with the NTP client app you can use local NTP. So not a big deal to me any more.

[dev:2276](http://192.168.2.160/logs/past#dev2276)2020-06-16 06:36:33.097 pm [info](http://192.168.2.160/device/edit/2276)Hub is 1592350592352 ms aka Tue Jun 16 18:36:32 CDT 2020

[dev:2276](http://192.168.2.160/logs/past#dev2276)2020-06-16 06:36:33.096 pm [info](http://192.168.2.160/device/edit/2276)NTP is 1592350593401 ms aka Tue Jun 16 18:36:33 CDT 2020

[dev:2276](http://192.168.2.160/logs/past#dev2276)2020-06-16 05:36:32.339 pm [info](http://192.168.2.160/device/edit/2276)Hub is 1592346992321 ms aka Tue Jun 16 17:36:32 CDT 2020

[dev:2276](http://192.168.2.160/logs/past#dev2276)2020-06-16 05:36:32.339 pm [info](http://192.168.2.160/device/edit/2276)NTP is 1592346993285 ms aka Tue Jun 16 17:36:33 CDT 2020

[dev:2276](http://192.168.2.160/logs/past#dev2276)2020-06-16 04:36:32.241 pm [info](http://192.168.2.160/device/edit/2276)Hub is 1592343392229 ms aka Tue Jun 16 16:36:32 CDT 2020

[dev:2276](http://192.168.2.160/logs/past#dev2276)2020-06-16 04:36:32.240 pm [info](http://192.168.2.160/device/edit/2276)NTP is 1592343393144 ms aka Tue Jun 16 16:36:33 CDT 2020

[dev:2276](http://192.168.2.160/logs/past#dev2276)2020-06-16 03:36:32.274 pm [info](http://192.168.2.160/device/edit/2276)Hub is 1592339792266 ms aka Tue Jun 16 15:36:32 CDT 2020

[dev:2276](http://192.168.2.160/logs/past#dev2276)2020-06-16 03:36:32.273 pm [info](http://192.168.2.160/device/edit/2276)NTP is 1592339793123 ms aka Tue Jun 16 15:36:33 CDT 2020

[dev:2276](http://192.168.2.160/logs/past#dev2276)2020-06-16 02:36:32.174 pm [info](http://192.168.2.160/device/edit/2276)Hub is 1592336192165 ms aka Tue Jun 16 14:36:32 CDT 2020

[dev:2276](http://192.168.2.160/logs/past#dev2276)2020-06-16 02:36:32.173 pm [info](http://192.168.2.160/device/edit/2276)NTP is 1592336192949 ms aka Tue Jun 16 14:36:32 CDT 2020
1 Like

Very interresting. I am wondering if anyone could tell me if i can set a raspberry pi to be the ntp server to answer to this ntp client, but a very simple one. I dont need to be so exact. I dont need gps and i dont use internet. I have already a rtc board on the pi and that works properly. If i install the linux ntp server, can i disable it from accessing the internet? Basically, i would like it to simply use its current computer time and date. The actual rtc is already keeping the system clock up to date.

Yes you can setup the pi as a NTP server really easy to do by just installing the NTP package and configuring. I wouldn't disconnect the pi from the internet because even the RTC board will drift over time.

Even with the GPS receiver in mine and my RTC board I do see corrections to the RTC based on the sync with GPS. You really need an authorative source for this solution to work will. The calls to the NTP pool are really infrequent once the software learns your drift rate.

Is there a reason you want to disconnect the PI from the internet?

Hi @ronv42, yes i want things to last. The only way is to disconnect from the net. Im doing all this to get off the net. So far it’s fantastic. But last time we got a power failure, the lights in the house were turning on during the day and black out completely at night :rofl:

I realised that HE needed to get the time somewhere. So i added a rtc to the pi. I have two networks completely independent with only one with the internet. One day i hope to have 95% of the devices off the net. Im getting there.

Ok I did setup the ntp server. And I see that HE can talk to the pi. Im going to test off the net now. Thanks a lot.

If you really want to be off the internet, get a GPS receiver for the Pi and set it up to get time that way. There are posts on this thread about that, not far above this. Then everything is off the net.

dfroula recommended the following guide in this post
https://www.slsmk.com/how-to-setup-a-gps-pps-ntp-time-server-on-raspberry-pi/

1 Like

That sounds very interesting. But i have some dought that i can get a descent signal inside my house made of concrete walls. The rtc is probably enough accurate for me. I only need the time to turn on and off the lights. If they are off by 10 minutes, i dont really care.

But... i still have a problem with the sync of all the pi to the one that has the rtc. HE have no problem talking to the ntp server but i cant get the other pi to get their time from the ntp server. I read and tried so many things from the net about that but cant get it to talk to the server. Any idea what i can try?

Does the second answer to this question look like it is happening on your NTP client Pi's when they reboot?

Hi, thanks for the info. But its still not working.

I do have in the ntp.conf file:

Server 192.168.2.34

The timedatectl status gives the following
Rtc time: n/a
System clock synchronized: no
Ntp service: inactive

Etc etc.

The ntpq -p gives me this

And apparently the using this command

Sudo timedatectl set-ntp 1

Should force the ntp to request the time, but nothing happens. I rebooted, nothing :weary:

I like technology, hubitat and that communauty !

We are here a bunch of "old guys" (but young in our brains) and I was thinking about your explanation.
When I was young, the only thing you could do with lightning strikes was to run on your porch and count 1,2,3 ... to assess where the lightning strike was ...

Now ? Just read your phrase again :smiley: :smiley:

2 Likes

Fwiw, GPS receivers are VERY sensitive, all things considered. I have my NTP-Pi in the basement with its antenna sitting in a window that is below the surface level of my back yard (fortunately, it has a window well!). It receives plenty of satellite signals and manages NTP quite well....

S.

1 Like

Does this override Hubitat's own checking of the remote server, or exist alongside it?

I believe it is in addition to Hubitat’s built-in background NTP time synch feature.

In that case it wouldn't alleviate the problem of the hub hanging when rebooting in an internet outage, I'd guess, as it would still be waiting for connection to that?

The hub doesn't wait forever for a response and the boot will continue. This NTP driver would set the correct time in this case.

5 Likes

Oh, might be worth a try then. I was hoping to use my QNAP for a server, manual says yep, QNAP device says nope, lol! Can use one of our linux boxes anyway.

The Hubitat Hub is designed to run with no internet, although in this case, it is up to the user to make sure the hub’s time is set correctly. This can be done via the web browser time synch feature in the Settings menu... Or, programmatically via a driver like the one in this thread.

QNAP works as an NTP server, if configured properly: QNAP Turbo NAS Software User Manual