python_sonnenbatterie
Python module to access the REST API of a Sonnenbatterie.
This modules contains two distinct sets of APIs:
- the original sonnen API (v1)
- the new v2 API
Both are available in a synchronous and an asynchronous version:
sonnenbatterie- SonnenAPI v1, synchronousAsyncSonnenBatterie- SonnenAPI v1, asynchronousSonnenBatterieV2- SonnenAPI v2, synchronousAsyncSonnenBatterieV2- SonnenAPI v2, asynchronous
The major difference between those two is the method to authenticate. With API v1 you need to login using a username and a password. The newer API requires a token that can be found in the web UI of your Sonnenbatterie. Also, the v2 API provides a unified view across the different Sonnenbatterie models wheres the v1 API may provide more details in specific setups.
When using the v1 API you'll autmatically get access to the v2 API by using the sb2
attribute of the v1 client object.
Installation
Using pip
pip3 install sonnenbatterie
Manual installation
Download the archive from pypi.org and unpack where needed ;)
Usage
SonnenAPI v1 - sync
# API v1
from sonnenbatterie import sonnenbatterie
sb_host = '192.168.1.2'
sb_user = 'User'
sb_pass = 'Password'
# Init class, establish connection
sb = sonnenbatterie(sb_host, sb_user, sb_pass)
print(sb.get_status()) # retrieve general information
print(sb.get_powermeter()) # retrieive power meter details
print(sb.get_batterysystem()) # retrieve battery system data
print(sb.get_inverter()) # retrieve inverter status
print(sb.get_systemdata()) # retrieve system data
print(sb.get_battery()) # get battery information
print(sb.get_api_configuration()) # get api configuration
print(sb.get_commissioning_settings()) # get commissioning settings
SonnenAPI v1 - async
# API v1
from sonnenbatterie import AsyncSonnenBatterie
sb_host = '192.168.1.2'
sb_user = 'User'
sb_pass = 'Password'
# Init class, establish connection
sb = AsyncSonnenBatterie(sb_host, sb_user, sb_pass)
print(await sb.get_status()) # retrieve general information
print(await sb.get_powermeter()) # retrieive power meter details
print(await sb.get_batterysystem()) # retrieve battery system data
print(await sb.get_inverter()) # retrieve inverter status
print(await sb.get_systemdata()) # retrieve system data
print(await sb.get_battery()) # get battery information
print(await sb.get_api_configuration()) # get api configuration
print(await sb.get_commissioning_settings()) # get commissioning settings
# Async needs to close the connection!
await sb.logout()
SonnenAPI v2 - sync
# API v2
# can either be access directly, see below, or
# via sb.sb2 (gets initialiazed automatically when creating a V1 object)
from sonnebatterie2 import SonnenBatterieV2
sb_host = '192.168.1.2'
sb_token = 'SeCrEtToKeN' # retrieve via Web UI of SonnenBatterie
sb2 = SonnenBatterieV2(sb_host, sb_token)
print(sb2.get_configurations()) # retrieve configuration overview
print(sb2.get_battery_module_data()) # get battery module data
print(sb2.get_inverter_data()) # retrieve inverter data
print(sb2.get_latest_data()) # get latest date from sonnenbatterie
print(sb2.get_powermeter_data()) # get data from power meters
print(sb2.get_status()) # get overall status information
print(sb2.get_io_data()) # get io status
SonnenAPI v2 - async
# API v2
# can either be access directly, see below, or
# via sb.sb2 (gets initialiazed automatically when creating a V1 object)
from sonnebatterie2 import AsyncSonnenBatterieV2
sb_host = '192.168.1.2'
sb_token = 'SeCrEtToKeN' # retrieve via Web UI of SonnenBatterie
sb2 = AsyncSonnenBatterieV2(sb_host, sb_token)
print(await sb2.get_configurations()) # retrieve configuration overview
print(await sb2.get_battery_module_data()) # get battery module data
print(await sb2.get_inverter_data()) # retrieve inverter data
print(await sb2.get_latest_data()) # get latest date from sonnenbatterie
print(await sb2.get_powermeter_data()) # get data from power meters
print(await sb2.get_status()) # get overall status information
print(await sb2.get_io_data()) # get io status
# Async needs to close the connection!
await sb.logout()
Metadata
Release files for sonnenbatterie 0.7.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sonnenbatterie-0.7.2.tar.gz | 35.5 kB | With provenance | Details for sonnenbatterie-0.7.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sonnenbatterie-0.7.2-py3-none-any.whl | Python 3 | none | any | Details for sonnenbatterie-0.7.2-py3-none-any.whl |
Total release size: 62.9 kB
Release files / sonnenbatterie-0.7.2.tar.gz
| Download URL | sonnenbatterie-0.7.2.tar.gz |
|---|---|
| Size | 35.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc6dfc4e581c731a71b7ad8a7d67a54d97f7f211e02a69ab1df3efbd5fddf069
|
|
BLAKE2b-256 checksum How to use checksums |
5eae66de887dff3fe151fa548dccc7c4eb98b9c549a5eac444e3a19dbf8bcba5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / sonnenbatterie-0.7.2-py3-none-any.whl
| Download URL | sonnenbatterie-0.7.2-py3-none-any.whl |
|---|---|
| Size | 27.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0659e09ffcce621eec482eaf61381db70318bda37cf7917e4f02f7067f219e5e
|
|
BLAKE2b-256 checksum How to use checksums |
455218581fe73c538eed058155eff18ec65528da651d3083b5242a272bfef2dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logSecurity for sonnenbatterie 0.7.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sonnenbatterie-0.7.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.