Skip to main content

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 EnergyManagerApi, EnergyManagerVersion

# create a new api object
energy_api = EnergyManagerApi(EnergyManagerVersion.CLASSIC, "<host_or_ip>")

# create a new api object for new energy manager flex
energy_api = EnergyManagerApi(EnergyManagerVersion.FLEX, "<host_or_ip>")

# optional, change work units to Wh instead of kWh
api = EnergyManagerApi(EnergyManagerVersion.CLASSIC, "<host_or_ip>", work_unit=WorkUnits.Wh)

# with custom logger
my_logger = logging.getLogger("my_logger")
energy_api = EnergyManagerApi(EnergyManagerVersion.CLASSIC, "<host_or_ip>", logger=my_logger)

# test the connection (returns bool based on success)
status = api.test_connection()

# pull data from the device (returns only selected power values, grouped by device class)
print(api.fetch_data())

Development:

Project uses uv for dependency management.

Rudimentary unit tests are included in the tests folder. These use static data from j́son files and do not require a connection to the device.

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

localsolarwatt-0.8.2.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

localsolarwatt-0.8.2-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file localsolarwatt-0.8.2.tar.gz.

File metadata

  • Download URL: localsolarwatt-0.8.2.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for localsolarwatt-0.8.2.tar.gz
Algorithm Hash digest
SHA256 657e924444b6486cfe096716fdb094896bce143a269b22254a49fddd8893a8d8
MD5 55ab6649e4a9f3eb6c3732438f07f80f
BLAKE2b-256 6705526806921583308ac5653ba8e0df1d53b05d5e98d36b3b135cee211bfba2

See more details on using hashes here.

File details

Details for the file localsolarwatt-0.8.2-py3-none-any.whl.

File metadata

  • Download URL: localsolarwatt-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for localsolarwatt-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 56c9972dc64536fc8719857ff98b08f57c348bd6d72c7f7c97301e50b732146e
MD5 f32985061d2bcc30a65b8b966c24f558
BLAKE2b-256 1a0d40e6bef50585a4ce9a25f0a261e0f8c7ec52df39573986a55fd46c8fd953

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page