Hello. I have my home assistant running in a raspberry pi connected to a cell phone battery. The battery works great for keeping the pi alive, but sometimes when the power outage is too long the home assistant is shut down incorrectly and the sd card is corrupted. I want to add a voltage sensor to the pi connected to the power cord and initiate an appropriate shut down if no power is detected. Any ideas?
There’s a shutdown host service for hassio:
service: hassio.host_shutdown
So you could use an ESP board running ESPHome to detect the voltage and an automation to call that service if the voltage goes below a set point.
Or get a bigger battery.
Yeah. I know how to do this in arduino, but don’t know how to access gpio in raspberry pi from home assistant.
So don’t use it. Use an esp board instead. Like I said above.
1 Like