Mode Manager and power outages

Hi, we've been having a number of PG&E precautionary power outages (no fun). I'm having trouble with Mode Manager not syncing back up after an outage. I'm guessing that HE boots up faster than my router and perhaps it doesn't get the correct time right away, then preventing Mode Manager from getting the correct event. Or the "sunrise" doesn't get set correctly on the first day.

For example, this morning I noticed some lights behaving funny and it was because the Mode was still in Night, but it was 10:30am.

Other than power outages, MM seems pretty good.

I'm guessing after a full 24 hours, it would self correct, but any thought on how to resolve sooner (and not manually)?

You need a power up rule. There is a location event called system start. Setup a simple trigger that fires on that, and it could set the mode for you. You could either have the time of day logic in the rule, or here's another way: First set the mode to Away, then turn on a virtual switch that triggers Mode Manager to "Use time settings to return from Away" (looks like you already have that switch). That would push Mode Manager through it's own time of day logic to set the mode.

Perhaps we should add an option to Mode Manager to do this: "Use time settings for system start".

6 Likes

Yes please!

Signed,
Mr. Mode :slight_smile:

Hi @bravenel,

I thought of this too, but is there still a problem if the HE boots up and fires this rule before the router is up? Seems like it would just fire the rule with whatever the default date/time is, unless HE has an RTC?

Is there a way to trigger a rule after DHCP occurs?

I support I could use your idea and just start it with a long delay, this would give the router time to boot, DHCP and be ready to allow HE to sync time.

Or if you use a local NTPd and used @dan.t's NTP Client.

1 Like

@aaiyar - I think after a power outage, there will be nothing on my network that has the correct time until after the router boots up.

This isn't a solution for the "normal" user, but if you have a spare rPi (or other 24/7 machine running somewhere on your network), you could setup your own NTP server and use that instead of relying on your router to come back up. That's what I do so that in the event of a power outage, my HE and my rPis come back up way faster than my modem does. With the rPi handling NTP requests, my HE is always sync'd to its time instead of having to go out to pool.ntp.org to get the proper time.

1 Like

@corerootedxb - how does your rPi get the correct time?

Also, I don't think HE, rPi or anything else on my network will have an IP address until after router is up.

My Odroid XU4 has an RTC with a cheap-■■■ backup battery. It has a fixed IP address and runs DHCP/DNS for my network. My HE has a statically assigned address so it's all good ...

2 Likes

I have a RTC (real time clock) hat on one of my rPis. Cost me ~$8 I think? (Mini RTC Module for Raspberry Pi | The Pi Hut)

On the same rPi, you can run DHCPd (open source DHCP server) or use something like Pi-Hole DHCP/DNS support and turn off DHCP on your router. That way, your router basically becomes a dumb pipe to the internet (which it should be) and not a bottleneck.

Believe me, this stuff is easy to setup and the returns are awesome.

@aaiyar Just in case I haven't told you lately, it is fantastic it when we are totally in sync! LOL

1 Like

More than you think :joy:

Same here ....

1 Like

thanks guys, great ideas!

2 Likes

If you have any questions about setting things up, hit me in PM (@aaiyar would be a great resource as well). Trust me, once you experience the joy of running pi-hole on your network, you'll be wondering why you didn't do it sooner. :slight_smile:

Network-wide ad blocking #FTW

1 Like

Besides all the above, have you considered putting your hub on a UPS? It's pretty low-power, so even cheap ones with low capacity should work (bonus points if they have USB without the need to re-adapt). I think Konnected and some others sell one that will work and are built for exactly this, but mine runs from a much larger one that can power most of my network during outages.

Of course, if these are long outages and you don't care to use any battery sensors in the meantime, your wishes may vary. It is a good way to help avoid database corruption regardless, though.

2 Likes

This is what I use to power all of my hubs in case of a power outage. Been tested a few times and lasted for hours.

2 Likes

You said : "My HE has a statically assigned address..."
How do you achieve that?

There are several threats trying to do it and nobody have a solution yet.... you are the first mentioning . :thinking:

Hi bravenel
How can we do this you mentioned here?:

How do you set a statically assigned address? You don't on the hub. You do so on your router. You need to log into your router and find in your DHCP table the hub. There should be an option to reserve the DHCP address. That forces the router to assign the same IP address to the hub when it reboots instead of assigning a random one. I do this for all my devices that I need to have the consistency of a fixed IP address. These include my C4 and C5 hubs, my Iris V2 indoor/outdoor cameras, my computer, my printer, my ROKU box, etc.

As others recommended, a good UPS into which your router, cable modem (or whatever provides your Internet access), your hub(s), your computer, and other devices. I have multiple ones here but I could use a couple more for some items out of reach of the ones I have. If you have a large enough UPS, it will carry you through a moderate outage. You have time to do graceful shutdowns of items if it is a really long outage. An UPS will also give you time to fire up and connect a generator if the outage will be really long also.

1 Like

LOL, I know that... I did not undertood then what you said before..... I though you was referring to do it on the HE.. now is clear.... and we will keep waiting for that feature, someday... someday

That's an incorrect statement on my part. The correct statement would be - my Hubitat is assigned a static IP address by my DHCP server.

1 Like