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
Metadata
Release files for dv-interfaces 2.0.1
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 |
|---|---|---|---|---|
| dv_interfaces-2.0.1.tar.gz | 286.4 kB | With provenance | Details for dv_interfaces-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dv_interfaces-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for dv_interfaces-2.0.1-py3-none-any.whl |
Total release size: 311.4 kB
Release files / dv_interfaces-2.0.1.tar.gz
| Download URL | dv_interfaces-2.0.1.tar.gz |
|---|---|
| Size | 286.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f52420a7faed67bb2add8cb0ad57f2ce547cf285bddb376bda534692b9a1d80d
|
|
BLAKE2b-256 checksum How to use checksums |
89c6335227547f144851c8cec07b49ed5246ddf3fcbb90626afb08bacb1050bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 22, 2026.
Transparency logRelease files / dv_interfaces-2.0.1-py3-none-any.whl
| Download URL | dv_interfaces-2.0.1-py3-none-any.whl |
|---|---|
| Size | 25.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be6c7d99db7b366a1bcf66488ed8d58d66fa0a57b00146844a7b3fc3e93813e4
|
|
BLAKE2b-256 checksum How to use checksums |
ae219035835bf8e3db69c713d73810ef27056d23e3fcb0ab62c1b631cd871fc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 22, 2026.
Transparency logSecurity for dv-interfaces 2.0.1
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 dv_interfaces-2.0.1.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 Jun 22, 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.