Python API
Use the Python APIs to integrate into your code
Sixfab offers Python API which allows a user to integrate UPS HAT v2 into their own project.
Requirements
Enabling the I2C on the Raspberry Pi.
To connect via I2C you’ll need to first enable the interface on the Pi. This is done via raspi-config which can be run in a terminal window:
sudo raspi-config
In the raspi-config user interface navigate to Interfacing Options >> I2C and answer the question "Would you like the ARM I2C interface to be enabled?" with . After the next reboot user pi will be able to use the I2C bus without root privileges.
Installation
Install pip3
If Python 3 has already been installed on the system, execute the command below to install pip3:
sudo apt -y install python3-pip
Install Power API
If pip3 has already been installed on the system, execute the command below to install power-api
pip3 install power-api
Uninstall
Use the following command to uninstall the library:
pip3 uninstall power-api
Upgrade
Use the following command to upgrade the library to the latest:
pip3 install power-api --upgrade
Methods
All the methods can be accessed from the API doc.
Examples
Here's a list of example actions that you can do using the Python API:
-
Note that you must configure the RTC with the set RTC example before creating an event. Otherwise, the events will not happen.
-
-
-
-
-
Usage
One of the simple ways to use the Python API is to use the Python Interpreter.
Updated over 2 years ago