HA on Rasp Pi with UPS

Hi,
I am running HA on a RPi. I have a UPS “hat” attached to it, which keeps it running if the power fails, but does not seem to work properly if the battery runs out. What it needs to do is shortly before the battery runs out, to save all running applications in such a way that they can be restarted and continue from where they stopped when the power returns, and shut the Pi down cleanly. When the power returns, it needs to restart the Pi and then restart all the hibernated applications so that they can all continue without disruption, and that no files are corrupted. What software do I need to achieve this? This must surely exist, because it’s something that many users will need.

Thank you - Rowan

I have my RP4 plugged into an APC UPS. I monitor for power outages in Home Assistant, send a notification if there is one, and issue shutdown (call service) before the battery is drained.

When power is restored, HA restarts. The states are determined by the integrations. For example: if a sensor is in a different state (set while the power was out) the new state is reflected in HA.

There are a number of posts in this forum with similar methods.

1 Like

Much the same here. Except there are some states which may no longer be valid because you don’t know how long power has been out. I have a “reset” automation which checks obvious things like time of day, light levels and occupancy and makes any adjustment necessary.