Unified Modbus TCP driver library for solar plant hardware used in Direktvermarktung
Project description
dv-interfaces
Unified Modbus TCP driver library for solar plant hardware used in Direktvermarktung (direct energy marketing).
Each device — SolarLog, SMA, Meteocontrol, Smartdog — exposes a different Modbus register map. dv-interfaces abstracts all of it into one consistent Python API for reading production data and sending output curtailment commands.
Context
Each device — SolarLog, SMA, Meteocontrol, SmartDog — exposes a different Modbus register map with different byte orders, slave IDs, and conventions. Without a shared layer, every integration has to rediscover and reimplement the same mapping work.
dv-interfaces removes that undifferentiated effort so you can build polling jobs, control paths, and validation tooling without touching raw register math.
The library covers Modbus TCP, the most common protocol for Fernsteuerbarkeit in Direktvermarktung. IEC 60870-5-104 is used in this space too but is not currently supported.
Installation
uv add dv-interfaces
# or
pip install dv-interfaces
Try it without installing
uvx --from dv-interfaces dv-detect 192.168.1.100
uvx --from dv-interfaces dv-read solarlog 192.168.1.100
Quick example
from dv_interfaces import get_interface
with get_interface('solarlog', '192.168.1.100') as iface:
ds = iface.read_dataset()
print(f'Production: {ds.production} W')
print(f'Grid feed: {ds.grid_feed:+d} W')
Supported devices
| Driver | Device | Protocol | Spec |
|---|---|---|---|
solarlog |
SolarLog (Modbus TCP DPM licence required) | Modbus TCP | Datasheet |
sma |
SMA cluster | Modbus TCP | TI Direktvermarktung |
meteocontrol |
Meteocontrol blue'Log XC | Modbus TCP | Remote Power Control |
smartdog |
ecodata PowerDog / SmartDog | Modbus TCP | Modbus Register List |
Features
- Unified
read_dataset()→DVDatasetacross all drivers - Write API:
turn_on(),turn_off(),limit_plant(percent) - Typed Modbus configuration with driver default slave IDs
stream(iface)generator — yields readings continuously, errors yielded not raiseddetect_interface(host)— identify an unknown device by probing Modbus registersread_dataset_result().to_dict()— flat dict for direct DB insertion or task queue backends- Auto-reconnect on dropped TCP connections
- PEP 561 typed
Issues and bugs
If you find a bug, a wrong register interpretation, or a device-specific edge case, please open an issue. Include the driver name, device model/firmware if known, the relevant Modbus register values, and the expected behaviour.
Development
uv sync
uv run pytest -m "not hardware"
uv run ruff check src/ tests/
uv run ty check
uv run mkdocs serve # local docs preview
Hardware tests
Set one or more DV_TEST_<DRIVER>_HOST variables and run the hardware marker:
DV_TEST_SOLARLOG_HOST=192.168.1.100 uv run pytest -m hardware -v
Tests for drivers whose host variable is not set are automatically skipped. Multiple drivers can be tested at once:
DV_TEST_SOLARLOG_HOST=192.168.1.100 \
DV_TEST_SMA_HOST=192.168.1.101 \
uv run pytest -m hardware -v
See the hardware testing docs for the full variable reference.
License
MIT, see LICENSE.
About
Built by Gregorio Rodrigo
Making energy market data easier to work with
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dv_interfaces-2.0.0.tar.gz.
File metadata
- Download URL: dv_interfaces-2.0.0.tar.gz
- Upload date:
- Size: 286.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
166e77ff40f73a62c9de3b1c535fee466b01e3048448c480a625da7a9b007147
|
|
| MD5 |
60345bbd23a1e8dce5ca72b30d5ae570
|
|
| BLAKE2b-256 |
c33501790655c056773bab9a83cadaf04ff0c29d22d88d492dc8af55491fc0d9
|
Provenance
The following attestation bundles were made for dv_interfaces-2.0.0.tar.gz:
Publisher:
publish.yml on grrodre/dv-interfaces
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dv_interfaces-2.0.0.tar.gz -
Subject digest:
166e77ff40f73a62c9de3b1c535fee466b01e3048448c480a625da7a9b007147 - Sigstore transparency entry: 1910250168
- Sigstore integration time:
-
Permalink:
grrodre/dv-interfaces@e7284530d730df46f7cb40f8621b28b232996625 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/grrodre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e7284530d730df46f7cb40f8621b28b232996625 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dv_interfaces-2.0.0-py3-none-any.whl.
File metadata
- Download URL: dv_interfaces-2.0.0-py3-none-any.whl
- Upload date:
- Size: 25.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ad7543c7ffbca1fe9ead458d2af1c96725a627795d7c57b87dbd8acfb4792dc
|
|
| MD5 |
6a96018372cb9a4ac9e396b353e62bd3
|
|
| BLAKE2b-256 |
504baf11af540fff2347e000ce9a2f66b39b1024a69db97b2e00fce27a0a1e8e
|
Provenance
The following attestation bundles were made for dv_interfaces-2.0.0-py3-none-any.whl:
Publisher:
publish.yml on grrodre/dv-interfaces
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dv_interfaces-2.0.0-py3-none-any.whl -
Subject digest:
6ad7543c7ffbca1fe9ead458d2af1c96725a627795d7c57b87dbd8acfb4792dc - Sigstore transparency entry: 1910250273
- Sigstore integration time:
-
Permalink:
grrodre/dv-interfaces@e7284530d730df46f7cb40f8621b28b232996625 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/grrodre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e7284530d730df46f7cb40f8621b28b232996625 -
Trigger Event:
push
-
Statement type: