Graceful Shutdown on Power Outage?

Hi, I have an RPi running Home Assistant (OS) in Greece where power outages are frequent and long.

Standard (APC) UPS is very inefficient: 230VAC > 12VDC > 230VAC > RPi Power Adapter > 5VDC …
Therefore, I bought a LiPo battery powered UPS HAT that connects to GPIO pins to notify RPi of outage. Now as I understand it GPIO support has been dropped from Home Assistant? Ouch!

I hope to avoid stepping to down from HA OS to a HA Supervised install, but I can’t figure out if and how I can trigger a graceful host shutdown from a (to be found/developed) integration that can access the GPIO pins and run a python3 script? Anyone care to explain/help me find a solution?

TIA,
Johan (from Belgium)

BTW: My UPS HAT is the UPSPack V3P as found on Amazon and documented on UPSPACK_V3/README_en.md at master · rcdrones/UPSPACK_V3 · GitHub

Mmm… The doc speaks about UART (i.e. serial), not GPIO

The UPS and the Raspberry Pie interact with each other via the UART interface for a much richer set of information

Three GPIO pins are connected. One is a binary-sensor for “SYSTEM_HALT” notification, which is the one I want to use. There is also a UI app that displays more information about the UPS & Battery status. That is indeed using the UART Tx and Rx pins. I can live without that if only I can gracefully shutdown the Pi.

Ok.

  1. Going from HAOS to HA Supervised won’t solve your issue, not sure why you think that.
  2. Somebody picked the deprecated RPI GPIO integration and pushed it to HACS. Just search for “GPIO” in HACS

Hi,

  1. The problem with the HA OS host is that there is no packager and the file system is read-only. If I would a vanilla linux with python3 and docker I can run the shutdown.py script at each boot and run HA Supervised install on top, no?
  2. Never knew HACS existed. Thanks for the tip. Will need to dig in to better understand the why, what and how. Is it future proof? community maintained? safe and secure? auto-updating?
    Thx & KR,
    Johan