Along with the Power Software, Sixfab also offers Python API which allows a user to integrate into their own project.
In order to use the Python API, you will definitely need to install the python library we are offering.
pip3 install sixfab-power-python-api
All the methods can be accessed from the API doc.
Here's a list of example actions that you can do using the Python API:
Use the following command to uninstall the library:
pip3 uninstall sixfab-power-python-api
Use the following command to upgrade the library to the latest:
pip3 install sixfab-power-python-api --upgrade
One of the simple ways to use the Python API is to use the Python Interpreter.
[email protected]:~ $
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
from power_api import SixfabPower, Definition, Event
api = SixfabPower()
Note: For a better experience, we recommend stopping the power_agent and power_request if connected to the power software. Run the following commands to stop the services.
sudo systemctl stop power_agent.service
sudo systemctl stop power_request.service
Using Python API, the settings of the Power HAT can be changed. Functions dependent on the agent cannot be used. These are: