So I thought I'd post a guide on how to do this as apparently quite a few folks would like this capability. The reasons for adding battery Backup to your Hubitat are varied but here are a couple:
- Prevent Hubitat Database Corruption in the event of a power outage
- Enable a graceful sahutdown of your Hubitat in the event of a long duration power outage
- If you are using HSM as your alarm system, your battery powered security devices will still work
Just a few things to note first:
You need to use a Networked IP device (with a static / fixed IP address) that is not on battery backup, doesn't crash for no good reason and becomes unresponsive, or your Hubitat will assume the power is out. It also needs to power back up when power is restored. I'm using my Raspberry Pi Workshop Computer and it works great (UPDATE: I'm now using one of my Synology MR2200ac Mesh Router's with a fixed IP).
- Get a battery backup system for your Hubitat. Make sure you buy the exact UPS device specified - there are lots of similar devices that do not provide continuous power when the power is cut. (buy a few units as QC can be hit and miss, I had 3 out of 4 work)
- Buy a Genuine, known Brand, good quality, 3500 mAh Cell - these are good for over 7 hours of runtime for a Hubitat C7.
- Get a nice 3D printed case to make it look professional - White plastic lets the status lights shine through the bottom which looks very cool.
- Install Hubitat Hub Controller via Package Manager
- Create a new virtual device named "Hubitat Controller" and change the driver to Hubitat Hub Controller .
- Install HTTP Presence Sensor via Package Manager
- Create a new virtual device named "" and change the driver to HTTP Presence Sensor
- Point your "Presence Sensor" device at a suitable IP device that will respond to HTTP commands and isn't on battery backup. Make sure you put HTTP:// in front of the IP address
- Setup a Rule Machine rule using a "Custom Action" to call a "Hubitat Hub Controller" shutdown and glue it all together. I use a 6-hour timer because my backup unit can run my C7 for over 7 Hours. This rule has auto-cancel enabled so if the Power is restored before the timer runs out, it will cancel the shutdown.
IF (Workshop Pi present(T) [TRUE]) THEN
Cancel Timed Actions: This Rule
ELSE-IF (Workshop Pi not present(F) [FALSE]) THEN
shutdown() on Hubitat Controller --> delayed: 6:00:00 (cancelable)
Here's mine with some of my Network gear: