Class based on pymodbus.ModbusTcpClient, completely interchangeable, just replace ModbusTcpClient() with SungrowModbusTcpClient()
-
Tested with HASS docker v2025.8.3 and Sungrow SG4K inverter
-
ALL the component code was ripped from the modbus custom component dev repository
https://github.com/pymodbus-dev/homeassistant_modbus. Unused code was removed. -
Copy the folder
sungrowmodbusinto your custom_components folder and add the integration toconfiguration.yaml. Example config provided for SG4K inverter insungrow_sg4k.yaml -
For standalone use (outside home assistant): copy the
sungrow.pyfile into your project and import the classAsyncSungrowModbusTcpClient. It is a decorator on top of the async modbus TCP client (AsyncModbusTcpClient) that handles encryption transparently.