I have been growing my home automation setup over the past two and a half years, and the setup has evolved to the point where I can keep an eye on the house using Home Assistant even when I'm away – provided that there isn't a power cut!
We went away recently, and we were sitting on the beach when I first started getting a load of emails, firstly from the Eaton 5SC UPS in my office:
And then I got a text message from Northern Powergrid that summarised the situation:
Usually, this wouldn't be a problem. My home office and network run off of a few small UPS devices, which means that in a power cut, my office can function for around 25 minutes, and the remainder of the home network can usually function for around an hour on battery power.
What slowly dawned on me was that Home Assistant wouldn't turn back on when power was restored. Until about a month ago, Home Assistant was running on a Raspberry Pi, which would have powered up as soon as power was restored. Unfortunately, I recently suffered a failure of the SD card, and when that happened, I chose to move Home Assistant to run off of a NUC (which has been great).
I thought about powering the NUC off the UPS when I migrated away from the Raspberry Pi, but I didn't have a spare IEC C14 to IEC C5 cable. The NUC has a momentary switch for the power button:
This means that when power is restored, the power button will have to be pressed to restore power – a disadvantage that the Raspberry Pi didn't have.
The result of this means that I spent the rest of our time away being able to keep an eye on the house via Home Assistant:
Moving forwards, I don't want to be in a position where a power cut will permanently interrupt my ability to use Home Assistant whilst I'm away.
Power Cut Resilience
The first thing I did when we got home was order another IEC C14 to IEC C5 cable so that I can power Home Assistant from the UPS.
Wake-On-LAN and VPN Access
Using the UPS isn't a silver bullet; if a power cut lasts longer than 20-25 minutes, that will be long enough to empty the UPS battery. If power is lost, I need a way to remotely power back on Home Assistant.
I can use Wake-On-LAN with VPN access to my home network to power on the NUC if it powers off. Unfortunately, on this holiday, I didn't have VPN access set up on my laptop since upgrading to the P1 a few months ago.
Once I'm connected to VPN, I should be able to use the wakeonlan package to boot the NUC from a powered-off state:
BIOS Power Settings Tweaks
I thought it would be worth checking the power settings to determine if there was anything in the BIOS that I could use to my advantage. It turns out that it's possible to control the after power failure behaviour.
Hidden, under Power
is a Secondary Power Settings
menu:
On the Secondary Power Settings screen, the After Power Failure option can be set to: Stay Off, Last State or Power On.
I've changed the After Power Failure option from the default of Stay Off to Power On.
Conclusion
Between these various options, I shouldn't find myself in a position where Home Assistant will lose power, and I cannot turn it back on remotely. In theory, the BIOS power option should "just work" and power on Home Assistant as soon as power is restored (if the UPS is fully depleted), but I have Wake-On-LAN and VPN access available as a fallback!