Question about time at startup

So just trying to understand here. I built some cool startup logic which is supposed to set all variables and modes when starting up in case the hub has been shut down too long due to a power outage or something. I had previously tested this logic, but never in an actual power outage scenario. Tonight, I had a pretty decent power outage. When my hub booted, my rule did not set my time of day variable as expected. When I looked at my logs, I had realized hub time was not correct when startup ran, in that it still believed it was close to the time the power had gone out.

By that time, the internet had not yet come back online. Does Hubitat have a CMOS battery to keep time? Or, does it require a an internet connection to retrieve updated time after being off? I guess the followup to that question if this is true is how to make the rule wait until it sees an internet connection so my time variable sets correctly. '

Thanks in advance for any input.

No

Yes

I keep my hub on a UPS. This solves most issues like this.

5 Likes

You can make a rule that after a system start and some delay ping the internet.

image

2 Likes

Yes. But it can be configured to use an NTP server on your LAN.

4 Likes

Thank you all, I will play with some of this!

I believe the reason I have never really this issue (or the one where the hub auto-assigns an IP address to itself (because the DHCP server had not yet started up after a power outage)) is due to the fact that most of my home networking equipment in on a UPS. That same networking hardware provides power to my HE Hub via a PoE splitter. Thus, if the power is out for a short period of time, nothing is impacted at all. If the power goes out for a long time, and then power is restored, my PoE switch actually takes a while to boot up before it sends power to my hub. By this time, my router and cable modem are already up and the hub is able to get its DHCP assigned address and is then able to query the Internet NTP servers to set it clock.

1 Like

While I don’t have PoE switches, my hubs and networking equipment are on a UPS.

When there’s 5% battery life left on the UPS as measured by an SBC, my hubs are shutdown gracefully, and then powered off (outlets are turned off).

When power returns, networking equipment is automatically powered up, along with the SBC. The automation on the SBC to turn on the outlets my various hubs are plugged into will not run until the SBC has received its IP address and can successfully ping my provider’s gateway.

2 Likes

@aaiyar What SBC do you use? How do you accomplish that in rule machine?

I use an Odroid N2 running Armbian. All the UPS smarts are done on the Odroid.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.