I live in an area that has no internet service. My only option is to use an ethernet bridge to my hotspot on my cell phone. So, basically, my system cannot get NTP info unless I’m home AND my hotspot is on.
Is there a way to update system time when there is internet available? Or possibly a way to sync it with my cell time? I really dont want to depend on being “connected” for a correct time reference.
Another potential option - buy a USB GPS dongle and use that to give your computer an accurate time reference. No internet required, though you will of course need to see GPS satellites at some point during the day/week to maintain accurate time.
How would I see of the hotspot is active? I only have 3 channels available for the phone, and none of them have anything to do with operations on the phone itself.
My understanding:
If hotspot is enabled, your phone will act as a wifi access point. If hotspot is disabled, your phone will not start the wifi access point.
Therefore the assumption, if OH can connect to the wifi and ping your phone, the hotspot is enabled.
I appreciate the reply Matthias. I have been using OH since 1.x, but i can honestly say that I have not had the time to invest in learning OH3… How would I go about checking to see if openhab is connected to the internet? I know how to find the phone, but looking in the rules, I see nothing about how to tell if OH is connected to wifi (actually plugged directly into router…I know with the network binding
I would advise you the same thing as T. At work I have setup a GNSS (gps) receiver in a mobile unit with lots of servers doing time critical stuff. The GNSS is connected to a raspberry pi. The pi has NTP service installed and all computers on that local LAN get their time from the pi. We also have an IO line for PPS (pulse per second) but for if you don’t mind the clock to be one second off then don’t worry about that.
Another idea could be to setup an NTP server on your phone. And letting the openhab host sync it’s time with your phone. Never done this but a quick google search gives me this: Time Server App - Apps on Google Play
If you don’t like any of the above solutions and want to do it with OpenHab, you could install the network/ping binding and let it check for internet connectivity to an ntp server. That could set an item switch to ON which you can use to run a rule. I don’t know if you can interact with your host system by using the rule but I do know that it’s possible to force the NTP service installed on windows and linux hosts to do a time sync.
Most OS for raspberry pi should have the NTP client installed by default and have set the NTP server address to which they sync their clocks to some kind of pool.
I can’t remember exactly but I think that client also allows to setup an NTP server. But that’s only necessary if you are going to attach a GPS receiver.
No, your Pi will connect to an external NTP server by itself. That’s all usually configured by default by the Raspberry OS. You shouldn’t have to do anything other than provide the hotspot.
Ok, so I can make sure Im on the same page. The pi will automatically update its time when it connects to my hotspot, otherwise it will keep time between. No need for the ntp binding at all?
That sounds about right. Make sure that the pi really has internet access when it’s connected and that NTP has a target that it can reach. Then it mostly depends on polling intervals. But you could force it using the command line just to test if your clock is set correctly.