Power cut kills Hassio - any fix while away from machine?

So I have had three power cuts over the past month and its really annoying as it means Hassio on Pi 3+ stops working.

I need to physically unplug the Pi then plug it in and it starts again. I normally work on my setup while at work using Duckdns. I have the pi connected to a unifi switch and have the unifi app but as far as I know I cannot do anything to resolve this issue remotely. Is there anything that can be done, or anything I can do while at home to prevent it happening next power cut?

Surely a power cut shouldnt cause HA to shut down and not restart when power back on?

Seems like it would be prudent to invest in a UPS. Even a small one could power a PI for hours.

Other than that, have it attached to a smart plug that you can trigger outside of HA.

3 Likes

I second @SteveDinn. I got a UPS for this very reason. You can get a reasonably priced one for $300 that even powers items back up if the power comes back using apc software.

For a PI alone, even a good USB battery pack would do the trick, as long as it can supply enough amperage.

Yah, I got a UPS because I’m using a nuc. I also added all my network gear (switches, router, etc) to the UPS. My entire network stays alive (Even internet… sometimes) when I lose power.

1 Like

Yeah, I’m with you. I have one to power a full desktop machine + monitor + network gear, but what would be minimal cost and get the job done for @Matt_Barnes?

:man_shrugging: I usually spend way to much on this crap. I always try to find a solution that solves every desire instead of going with the cheap options.

cheers guys. I thought about a UPS just seemed excessive for the problem at hand, as I reckon the power has cut for maybe a minute each time and all other tech in the house is back up and active but for whatever reason HA doesnt. It is odd that unplugging it and plugging it back in makes it work, but having a power cut and then it coming back on does not help.

An Ikea tradfi style wifi plug is a good shout though. I was sort of hoping for a software solution a config setting or some guidance on whether I could ssh into the Pi from outside my network. I should have installed it on a docker on my NAS but that wasnt really an option when I started but I can access my NAS from outside. Think the plug or maybe UPS is a good idea depending on costs.

I assume the pi boots faster than your router to get an ip.
Maybe a fixed ip could help?

The pi is fixed ip and I can see it connected to the wifi network using my unifi app. The pi is powered and connected but something stops HA loading up. I know when I get home I will not be able to connect to the HA instance until I unplug it and plug it back in.

One last thing I can think of…check the very last section of this page:

If you want to restart the Home Assistant service automatically after a crash, add the following lines to the [Service] section of your unit file (mine is /etc/systemd/system/hass.service):

Restart=on-failure
RestartSec=5s

oh thanks. worth a try for sure!

Was able to connect to it using ssh. Keyed reboot now as read that would work but then ssh lost connection and now says socket not connected.

Need to go up in the attic, unplug it!