Sixfab Power API is offered for the UPS HAT v2 for easy integration into the user's project.
PS. This API is strictly for Sixfab UPS HAT v2. Sixfab UPS HAT v1 users should follow UPS HAT v1 API. All methods of UPS HAT v1 are accessible from UPS HAT v1 API Doc.
Before we install the API, enable the I2C of the Raspberry Pi as the Sixfab UPS HAT v2 and the RPi communicates over the I2C.
To enable it run
sudo raspi-config
and navigate to Interfacing Options >> I2C. Select YES as the answer of the question "Would you like the ARM I2C interface to be enabled?
If you don't have the pip3 install on your Raspberry Pi install it pip3:
sudo apt -y install python3-pip
Now run the following command to install the API.
pip3 install power-api
The API can be upgraded to the latest package if available.
pip3 install power-api --upgrade
Installed API package can be uninstalled uysing the following ccommand.
pip3 uninstall power-api
Here are some example codes that has been prepared the Python API.