Activity rule to shutdown hub in a power failure

The contact sensor @aaiyar posted does not require solder. Inside the sensor there is a two terminals you loosen with a flat head and then insert the wires. Like this

But yes I agree if this work is a great alternative.


Not needed if the intent is the shutdown the same HE to which the Ring sensor is paired. The http POST endpoint can simply use the loopback/localhost IP address (i.e., so nothing travels beyond the hub.

However, it is really important for the HE itself to be on a UPS.

1 Like

Not sure how to implement this. Currently I am using

http://hubIP:8080/hub/shutdown with getPost

but have not really got into testing the shutdown function as I am focusing on the UPS.


Yes the hubitat hub is on a ups and if the router is not needed, then I'm not restricted to have a hub shutdown within 15min before the router ups runs down. This would allow me to have the hub shutdown possibly within an hour of the power failure so if power restored within that time a shutdown would not be needed


What you're using also doesn't need the router, because HE knows the hubIP is bound to its own eth0 interface.

You could replace it with "" and it would work just as well.


So either power monitoring solution, paired with a rule using the local loopback

Would require nothing else, but the Hub be powered on (and monitor via battery)



However, that also means that if power is restored before the UPS totally runs out of juice, the hub will not come back up when the power comes back on. If you were not at home, you'd have to have some type of Wifi plug that you could power cycle to get the hub to come back on.


I understood this and depending on how long my low cost UPS holds up I'm not going to worry about this condition. If the UPS lasts 3 - 4 hours from what we've experienced in our home, the Hub will be the least of our worries.

But a good point.

1 Like

And you can setup a rule that the http POST is not sent if power is restored .....

On a side note...who's going to come up with a "Smart UPS" that has a microcontroller built into it to do all of this automatically?!?! I think between the lot of us we might have come up with a very popular new product! it wouldn't take much more than a UPS, a microcontroller (like an ESP board) and a few relays. Oh, if only I wasn't so lazy. :wink:

So if i wrote a rule it would utilize custom attributes, for attributes choose power source then for value choose "change" and for action choose http post and insert "" .

Also I have to unsecure my hub for this to work

You'd want a conditional action.

IF powersource = mains THEN
     Cancel Delayed Actions
    Delay actions for X minutes cancelable
    Send HTTP Post message
1 Like

So was i correct in the trigger portion of my rule using a custom attribute then use Ryan780 conditional action?

I'm sorry...Yes, your trigger was correct.

No apologies necessary. Just appreciate everyones help

1 Like

Currently my untested RM4 rule is:

1 Like

I would change that to From Cancel Timed Actions to Cancel Delayed actions.

1 Like

Thanks, will do. Now that you said it, it makes sense.

1 Like

Concerning after the hub has been successfully shutdown, if I'm home do i just do a hub reboot from settings? I'm guessing, if I'm away from home there's nothing i can do to get the hub up an running without a complete shutdown of power and restart of power which would be difficult because I'm using a konnected alarm battery pack?

You won't be able to access settings if the hub is shut down, right? :slight_smile:
You would just have to unplug the hub from the battery pack and then plug it back in.

Correct. If the battery pack runs dry, then the hub will come back on when power is restored. But if the battery doesn't lose all power, the hub will continue to be off until you unplug it and plug it back in.