Shutdown scripts for SupTronics/Geekworm X750 UPS HAT for Rasperry Pi, based on the original scripts from Geekworm. It also reads the status of address 0x14 which can be used to determine the charging status. Kudos goes to Anonymous user #19 in the comments section of hardware the overview for this hint.
I'm using these scripts in my Portable Musicbox.
> git clone https://github.com/one-step-behind/suptronics-x750-scripts.git
> cd suptronics-x750-scripts
> chmod +x install.sh
> ./install.sh
ups-x750-check
is watching the batteries health (voltage, capacity and charging state). If batteries were not charging and voltage and capacity reaching a critical level it will shutdown the Pi safely and the power for the Pi is cut completely by the X750.
ups-x750-shutdown
is polling the momentary switch connected to the X750 board. If switch will be pressed for more than 4 seceonds the Pi shuts down safely and the power is cut completely by the X750.
The power will be cut hard if the button is pressed more than 8 seconds. This "feature" is built into the MCU of the X750 and cannot be changed by any script or user.
ups-x750-test.py
can be run from console and display some values of the batteries and charging state, e.g.:
******************
Voltage raw: 4.12125
Voltage: 4.12V
Battery: 87%
Status: 198
USB Power Connected 2A Charging
******************