Sadly I might have to move away from HA. It is simply not reliable. During the first week of setting it up my son hit the power button for the strip it was plugged into, shiny bright buttons attract kids and s&#* happens, and trashed the install. I had to completely wipe the card and reinstall everything. I luckily had most everything backed up. And again today 5 minutes before I walked out the door power got cut off again, again trashing the install. I hate to say it but that just isn’t going to work. Power loses happen. Am I supposed to have a battery backup with a stand by generator just so this one device won’t nuke its self everytime power is lost? How am I supposed to explain to the wife we have no outdoor lights because this little ‘toy l’ stopped working because a switch got flipped.
If a power cut to your device trashes your entire installation you have much bigger problems than homeassistant.
Good luck with whatever you you move to.
If your on a pi that is common…a small ups could solve that …or move more reboust hardware like a nuc… It is not the software that is your problem but rather hardware
Why is the Pi so vulnerable to power outages?
I used to have power issues at my house that made my Pi unresponsive every few weeks, but never led to SD card corruption and re-install. A few things you should check on your Pi.
-
Use a 2.5A power supply made for the Raspberry Pi 3B+, not a power charger used to charge phones. The power supply provides consistent 2.5A power vs. more volatile power chargers. If you hook up your Pi to the TV and see that the logs are reporting undervoltage constantly, then you need change to a power supply. Undervoltage may cause hard to diagnose problems like SD card corruption.
-
Use a high endurance SD card if you have one. I switched to one to be safe, but I didn’t have problems with a normal Sandisk 16gb SD card before. I would focus on getting a proper power supply and UPS first before going this route.
-
Get an APC UPS for $20. Check slickdeals.net for sales. Newegg.com regularly sells one for $20, which I’ve been using on my Pi for weeks without issue so far.
If you don’t want to throw more money at this problem, then you should quit now and wait another year or two to see if things have improved. Most likely it won’t, because it sounds like more of a Pi issue than HA. With any home automation solution, you will be spending a lot of time to maintain unfortunately. I haven’t found a true ‘set it and forget it’ reliable solution–even the basic SmartThings hub can still cause problems with its automatic firmware updates.
Another option you have is to get a SmartThings hub, configure your basic light automations there, and connect SmartThings to HA using MQTT. SmartThings functionality is terrible and has other downsides (internet reliance), but at least it’s been stable at my friend’s house for almost a year. It has a battery backup option (uses 4 AA batteries) that may negate the need for a UPS.
Agreed - this is not an HA issue.
Maybe you want to try running it from a USB stick instead of an SD card - I haven’t tried it yet, but I’m seriously thinking about moving my install to an external SSD and boot/run the whole thing from there to avoid these potential issues.
I’m also running RPi-Clone at least once a week - in addition to backing up everything in my config folder regularly - and I had one occasion where this was a complete life-saver.
RPi-Clone looks a little intimidating at first, but it really is not.
Have a 2.5amp power adapter bought with the pi, and I have a high performance 32gb memory card that i used to use for my gopro until i bought 64gb cardsfor that. No it is not an old card that is worn out. I used it a grand total of two times on my gopro until i decided 32gb was too small for 4k video. Now I can deal with maintence and bugs, but this is a complete unrecoverable crash upon power loss.
I’ve been looking at getting a synology or qnap nas. That might be a viable option, and that would be something that would be attached to a ups. Eventually I was going to move the Pi to my basement network cabinet once I had everything installed and configured.
Agree, this is more likely a hardware issue.
You only have to google for corruption on RPi after power loss and there are hundreds of cases. most recommendations are UPS
Not so much the RPi but the SD card. Many Single Board Computers (SBC) use an SD card for storage and the RPi just happens to be the most popular. Therefore it gets the bad rep for ‘vulnerability’ but it’s not at fault.
If you cut power while the OS is writing to the SD card, you run the risk of corrupting the file system. You also run the risk of having the card place itself in permanent read-only mode. Yes, it can do this and it’s by design (sort of a self-defense mechanism that limits further data corruption; preserves what it contains). When in this mode, the card is no longer usable as read-write storage.
To all the people wishing to switch from SD card to USB flash drive, you should know the technology is effectively the same. Both have the same limitations. For best results, consider SSD.
FWIW, there are numerous threads in the openHAB community forum dedicated to the woes of SD cards. In a nutshell, you must have a backup, a spare SD card, and a UPS (or battery backup). It’s not a matter of if the SD card will die but when.
Here’s are two applicable threads:
Last but not least, a good explanation of how SD cards work, what can make them fail, and what you can do to minimize experiencing those failures.
So I was able to recover after messing with it for about an hour. Once I restarted without the z wave adapter in, it booted but was all jacked up. The hass.io tab failed to load along with several other errors. Once I shut down all the plugins and restarted properly most of the errors went away. After that I was able to reboot and restart all the plugins and plug the z wave adapter back in. But my original point still stands, if we’re going to be connecting and automating every part of our houses the infrastructure must be reliable and damn near bullet proof. I use the grandma test for every piece of tech I install in the house. It’s why I won’t connect any of the lamps to any home automation system. ‘grandma’ simply wouldn’t understand why you have to use a scene switch instead of the manual switch below the bulb. It was the defining point when I setup the entertainment system and harmony ultimate.
Stop using a toy and get a real computer to run it.
SD card is toast. You might be able to write a new image to it or just get a new one.
Info for bcm2835_sdhost.
While hass.io has its quirks and learning curve, this sounds most likely an SD card issue.
Just saw on slickdeals a high endurance SD card:
I’ve heard this can help
Oddly, I was able to recover by removing the usb z wave adapter. And the SD card wasn’t used but a couple of times before I put it in HA. And this thing hasnt been running anymore then a month.
Just a note on UPS sales, this thread reminded me that I had been meaning to get some… Slickdeals pointed me to a couple sales currently running: B&H has a 450VA for $30, and Office Max/Depot has a 650VA for $35.
The two solutions have been mentioned already:
Get a UPS
or
Run HA on a device with proper storage that can deal with power outages in a better way.
I do both. Because if you’re using something to control your home, why skimp on it?
One issue that we are not addressing is the underlying filesystem of the OS. Hass.io seems to be quite brittle. I am not sold on the docker environment on a Pi.
I think a solid raspbian or Armbian well known OS on a reliable File system might address some of these issues. Maybe I am unwarentedly weary of the docker model. But that for sure impacts the reliability of the system across power losses (things shutting down and starting up in order seem to be harder to manage in the docker model)
All that being said, I use a battery designed for the pi like this one: https://www.amazon.com/Lithium-Battery-4-USB-Expansion-Raspberry/dp/B072Q49N48
All raspberry pi OS’s suffer from the file system corruption using SD cards, a quick google can see hundred of file corruption issues across all flavours of OS
I dont think hass.io underlying OS is any different to them
On the docker side, i run HA in a docker stack and i have no issues along with the other 10 or so accompanying containers