SolarEdge Modbus Module with MQTT sender/receiver
Python module and CLI for reading SolarEdge SunSpec Modbus data and writing setting registers when needed.
MQTT gateway documentation:
Implementation is based on the spec file in this repository:
sunspec-implementation-technical-note.pdf(Version 3.2, June 2025)
Supported model blocks:
- Common model block (base-0
40000) - Inverter model
101/102/103(base-040069) - Multiple MPPT model
160(base-040121)
Install
uv sync
CLI Usage
The CLI uses base-0 Modbus addresses, as in protocol address format.
Read common model over TCP:
uv run python main.py --transport tcp --host 192.168.1.50 --port 1502 --unit 1 read-common
Read inverter metrics:
uv run python main.py --transport tcp --host 192.168.1.50 --port 1502 --unit 1 read-inverter
Read MPPT extension model 160:
uv run python main.py --transport tcp --host 192.168.1.50 --port 1502 --unit 1 read-mppt
Read raw registers:
uv run python main.py --transport tcp --host 192.168.1.50 --port 1502 --unit 1 read-registers 40069 52
Write a single register (use carefully):
uv run python main.py --transport tcp --host 192.168.1.50 --port 1502 --unit 1 write-register 40068 2
Set C_DeviceAddress (valid range 1..247):
uv run python main.py --transport tcp --host 192.168.1.50 --port 1502 --unit 1 set-device-address 2
RTU example:
uv run python main.py --transport rtu --serial-port COM3 --baudrate 115200 --unit 1 read-inverter
Python Module Usage
from solaredgemodbus2mqtt.solaredge_modbus.client import SolarEdgeModbusClient
with SolarEdgeModbusClient.tcp("192.168.1.50", port=1502, timeout=3.0) as client:
common = client.read_common_model(unit=1)
inverter = client.read_inverter_data(unit=1)
print(common.to_dict())
print(inverter.to_dict())
# Optional write operation for supported setting registers.
# Example: set C_DeviceAddress
# client.set_device_address(new_unit_id=2, unit=1)
Notes
- Scale factors are applied to values according to SunSpec rules.
- Not-implemented values are returned as
Nonewhere relevant. - Write operations are available, but whether a specific register is writable depends on device firmware/configuration.
Pydantic Schemas
The package includes Pydantic models to validate and describe parsed data fields:
CommonModelSchemaInverterDataSchemaMpptUnitDataSchemaMpptModelDataSchema
Example:
from solaredgemodbus2mqtt.solaredge_modbus.client import SolarEdgeModbusClient
from solaredgemodbus2mqtt.solaredge_modbus.schemas import InverterDataSchema
with SolarEdgeModbusClient.tcp("192.168.1.50", port=1502) as client:
inverter = client.read_inverter_data(unit=1)
validated = InverterDataSchema.from_inverter_data(inverter)
print(validated.model_dump())
Testing
Install dev dependencies and run tests:
uv sync --group dev
uv run pytest -q
Test layout:
tests/test_parsing_unit.py: unit tests for low-level parsing and scale factor handlingtests/test_client_integration.py: integration-style parsing tests with mocked Modbus readstests/test_schemas.py: Pydantic validation tests
Metadata
Release files for solaredgemodbus2mqtt 1.1.0
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 |
|---|---|---|---|---|
| solaredgemodbus2mqtt-1.1.0.tar.gz | 1.2 MB | Without provenance | Details for solaredgemodbus2mqtt-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| solaredgemodbus2mqtt-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for solaredgemodbus2mqtt-1.1.0-py3-none-any.whl |
Total release size: 1.2 MB
Release files / solaredgemodbus2mqtt-1.1.0.tar.gz
| Download URL | solaredgemodbus2mqtt-1.1.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
66b3467b27efbc5dcba0ed8061e3190ba9e84ac861aafc283c86961578c6d217
|
|
BLAKE2b-256 checksum How to use checksums |
d4d11dcd1a6be3075f354b52fd37d3d398af009541b8ae7a8ea16b95a37f986d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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}
|
Release files / solaredgemodbus2mqtt-1.1.0-py3-none-any.whl
| Download URL | solaredgemodbus2mqtt-1.1.0-py3-none-any.whl |
|---|---|
| Size | 29.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5abde74835916e5f0eeb60b6183b648b55526212034b6f5f25f574283d192973
|
|
BLAKE2b-256 checksum How to use checksums |
df69de9d13f2b0922335c7a11d24db6f24e2dfa2f10f6535bda9c53c8d1d4bc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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}
|
Security for solaredgemodbus2mqtt 1.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.