Skip to main content

sunsynk-modbus

Read Sunsynk single-phase hybrid inverters (SG01LP1 family: 3.6, 5 and 8 kW) over Modbus.

The library is built on modbus-connection's device-modelling framework, the same foundation as Home Assistant's Modbus device integrations. It holds the inverter's register map and decoding only. The caller owns the connection, so you can reach the inverter however suits you:

  • a Modbus TCP gateway on the inverter's RS485 port, such as an ESP32 or a USR-style adapter;
  • a USB RS485 adapter;
  • RTU over TCP.

Install

pip install "sunsynk-modbus[tmodbus]"

Usage

import asyncio

from modbus_connection import ModbusTcpParams
from modbus_connection.tmodbus import ModbusConnection
from sunsynk_modbus import SunsynkInverter


async def main() -> None:
    conn = ModbusConnection(ModbusTcpParams(host="192.168.1.50"))
    inverter = SunsynkInverter(conn.for_unit(1))  # unit = the inverter's "Modbus SN"
    try:
        await inverter.async_update()
        print(inverter.identity.serial_number)
        print(inverter.readings.pv_power, inverter.readings.battery_soc)
        print(inverter.energy.total_grid_import)
    finally:
        await conn.close()


asyncio.run(main())

What each poll reads:

  • async_update_readings(): live power, voltage, current, temperature, state and fault values. Cheap enough to run every few seconds.
  • async_update_energy(): the daily and lifetime kWh counters.
  • async_update(): both.

The identity (serial number and rated power) is read once, on the first poll.

Sign conventions

These were checked on a 3.6K-SG01LP1:

Value Positive Negative
battery_power, battery_current discharging charging
grid_power, grid_ct_power importing exporting

Inverter settings

  • Port settings: the RS485 port runs at 9600 baud, 8N1.
  • Unit ID: set Settings → Advanced → Multi-Inverter → Modbus SN to the unit ID you poll, usually 01.
  • After a firmware update: a firmware update can reset Modbus SN to 00. At 00 the inverter doesn't respond at all.

Scripts

python script/query.py 192.168.1.50                 # print every value
python script/query.py 192.168.1.50 --watch 5       # live power readings
python script/query.py 192.168.1.50 --raw 150 45    # dump raw registers
python script/fake_inverter.py                      # serve the test fixture on 127.0.0.1:5020

Development

python -m venv .venv && .venv/bin/pip install -e . --group dev
.venv/bin/ruff check . && .venv/bin/mypy && .venv/bin/pytest

tests/fixtures/sg01lp1_3k6.json is a register snapshot from a real 3.6 kW inverter, with the serial number replaced.

Credits

The register map follows kellerza/sunsynk's single-phase definitions.

Metadata

Release files for sunsynk-modbus 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sunsynk-modbus 0.1.0
File Size Uploaded
sunsynk_modbus-0.1.0.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sunsynk-modbus 0.1.0
File Interpreter ABI Platform
sunsynk_modbus-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 kB

Release files / sunsynk_modbus-0.1.0.tar.gz

Download URL sunsynk_modbus-0.1.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
20dac6c00178f093daf76505f965aefe94aefaeacd68530096857d3f23597713
BLAKE2b-256 checksum
How to use checksums
b46ef75280d343b6d1cccb3638b695f229de0e2d1ca2ae6814f89e94eebc8c45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 9, 2026.

Transparency log

Release files / sunsynk_modbus-0.1.0-py3-none-any.whl

Download URL sunsynk_modbus-0.1.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d6273014defb569edeba690d090b140f55f79fe9cfffad763521332a439a20d
BLAKE2b-256 checksum
How to use checksums
21c5f48e3e75922c2ce079f184bd07c3f33ba80f702ea2065542a414448bd255
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 9, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page