Internet Connection lost - Hub never reconnects

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.

Not that it affects me personally, but was thinking a little about this before. The average Joe probably won't want to faff with setting up an NTP server if there's no internet connection.

I've not looked if it's possible, but how about a simple App that stores and checks the current time every minute?

That way, a simple "if the current time is LESS than the stored time, set it to the stored time" would at least keep the time from drifting back to firmware install date?

Worse drift case would be however long HE was powered down for, if it's down for 10 minutes the drift might be 11 minutes.

May even be possible in RM (no idea if it can do time based math)?

Does anyone have experience with Curl, does this look like the right syntax? I haven't had a chance to try it yet but was hoping to setup an AT Job this weekend to run the command at least around 4 am daily (figuring the daily maintenance will be done by then). I may decide to run it more in case of a reboot but not sure how frequently yet maybe once an hour.

I was able to test the curl command and it works as long as there is no Hub Login Security enabled. Iโ€™ll get this setup this weekend on my Dadโ€™s hub so it will work offline. Although Iโ€™m still hoping support will be able to fix this issue with a firmware change so it works offline as itโ€™s supposed to.

Update here is .bat file I created which will format the time as needed by Hubitat, in case anyone else wants to use this until a solution is provided by the support team who have said they are looking into what they can do about this. Just change the HubitatIP to your hub's IP and the CurlEXE to where you copied curl.exe to

@Echo OFF
cls
Set Home=%~dp0
Set HubitatIP=192.168.23.21
Set CurlEXE=%SystemDrive%\Util\Curl\Bin\Curl.exe
Rem You can download Curl from curl for Windows
Rem Get all the current time parts needed for Hubitat
set Month=%date:~4,2%
Set Day=%date:~7,2%
Set Year=%date:~10,4%
Set Hour=%time:~0,2%
Set Minute=%time:~3,2%
Set Second=%time:~6,2%
Rem For single digit hours replace the space with a 0 so " 1" becomes "01" without "s
for /f "tokens=* delims= " %%a in ("%Hour%") do set Hour=%%a
if %Hour% LSS 10 Echo 0%Hour%
Rem Replace the month number with the three letter abbreviation
if %Month% EQU 01 Set Month=Jan
if %Month% EQU 02 Set Month=Feb
if %Month% EQU 03 Set Month=Mar
if %Month% EQU 04 Set Month=Apr
if %Month% EQU 05 Set Month=May
if %Month% EQU 06 Set Month=Jun
if %Month% EQU 07 Set Month=Jul
if %Month% EQU 08 Set Month=Aug
if %Month% EQU 09 Set Month=Sep
if %Month% EQU 10 Set Month=Oct
if %Month% EQU 11 Set Month=Nov
if %Month% EQU 12 Set Month=Dec
Rem Format the time as needed for Hubitat
Set TimeFormat=%Day% %Month% %Year% %hour%:%Minute%:%Second%
%CurlEXE% -d "%TimeFormat%" -X POST http://%HubitatIP%/location/updateTime

Here is the command to install the ATJob for hourly where yyy is the full path and file above like C:\temp\HubitatTimeSync.bat

schtasks /create /RU SYSTEM /SC HOURLY /TN "Hubitat Time Keeper" /TR "yyy"

3 Likes

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

Thanks, the time sync bat file I wrote to get the time in the above form and send the commands with CURL is working well and keeping my Dad's hub time in sync with the Windows server! The last few days are the first time his sunrise rules have worked. The only downside is I haven't found a way to use Curl yet if the Hub Login Security is enabled.

Back to the original topic. This is STILL a problem, the hub will not reconnect at all, it must be rebooted, with an active connection. Upon reboot I got a 'time doesn't match" popup. Had I updated (I did not) it would have fowled up many rules. I wonder is this is related to hub forgetting my location the other day?

I have my internet shut down nightly. My hub reconnect's on it's own once the internet comes back up at 5am. I do have an NTP driver created by @dan.t that keeps the time in sync with my Synology NAS. Currently running the latest 2.1.9 release.

So let me clarify, when my C4hub is running and has a static IP, and I pull the cat 6 cable going from hub to switch, and then reconnect the cable after a minute or so to another port on the switch, the hub will not reconnect. It's an unmanaged switch.