python api wrapper for solar watt device api
Project description
LocalSolarWatt
A python3 library to access the data of solar watt devices via local api
Disclaimer: This library uses an unofficial local api and could therefore break at any point
Overview
The package uses the kiwigrid api provided by your solar watt energy manager device.
Data available:
- Real time power values from inverter, AC sensor and battery (if exists)
- Long term energy statistics
This library does some preprocessing by extracting relevant fields and grouping them by device class.
For now this mostly includes data I deem usefully for the integration with home assistant.
Note: Polling the energy manager with a very high interval often could lead to reliability issues (untested).
Supported devices
As I only have access to one installation and the api is as far as I'm aware not documented by SolarWatt, I can not guarantee that this library works with your setup.
If you encounter issues with your concrete setup, feel free to open a new issue.
The raw json data is available via http://YOUR_DEVICE_IP/rest/kiwigrid/wizard/devices
If you can provide the raw json dump, I can try to add support for your device.
Important Note: This data does contain some sensitive information (especially for the "Location" device), so make sure to remove any sensitive data before sharing.
Installation
pip install LocalSolarWatt
Usage
from local_solar_watt import Api, WorkUnits, DeviceClass
# create a new api objects
energy_api = Api('hostname or ip')
# optional, change work units to Wh instead of kWh
api = Api('hostname or ip', work_unit=WorkUnits.Wh)
# optional, change log level
api.set_log_level('WARNING')
# test the connection (returns bool based on success)
status, data = api.test_connection()
# pull data from the device (returns only selected power values, grouped by device class)
print(api.pull_data())
# You can also pull the raw json data for your own parsing needs
print(api.pull_raw())
Tests:
If you want to run the tests locally make sure to set the following environment variables to correct IPs / hostnames
ENERGY_MANAGER_HOST
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for LocalSolarWatt-0.7.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48a9187be93854bc0edee12ffea8f36035993ae316fbb20712f1a668aecfe60a |
|
MD5 | 74b4c03b2cfe534301a56d8771a79198 |
|
BLAKE2b-256 | c925e0e56fd68306375494ac03610d8f61043748b746c7d33d7ab744c74158c7 |