If you run a Huawei SUN2000 and read it over Modbus from more than one place, you’ve
probably hit this: the inverter’s Modbus TCP interface accepts only a very small number
of concurrent connections. Home Assistant polling sensors, a surplus heater reading grid
feed-in, and a dashboard open on a tablet is already enough. The symptoms are subtle —
sensors going unavailable for a minute and coming back, reads timing out at random, and
eventually connections being refused outright.
The usual advice is “poll less often”, which trades away the responsiveness you wanted in
the first place. So I put a small proxy in front of the inverter instead:
- holds exactly ONE connection to the SUN2000 and polls a configured register set
(default every 10s) - serves those cached values to any number of Modbus TCP clients (FC3), instantly
- forwards writes (FC6) straight through, so control paths still work
- keeps serving the last known values if the inverter is briefly unreachable, instead of
failing every client at once
Point Home Assistant’s Modbus integration at the proxy’s host and port 5502 instead of
the inverter on 502 and nothing else changes:
modbus:
- name: huawei_inverter
type: tcp
host: 10.0.0.60 # machine running the proxy
port: 5502
sensors:
- name: PV Power
address: 32080
input_type: holding
data_type: int32
unit_of_measurement: W
device_class: power
Pure Python standard library — no dependencies. Docker, compose and a systemd unit are
included. MIT licensed.
Running it in production on a ~9 kWp SUN2000 with a LUNA2000 battery, feeding Home
Assistant and a my-PV AC·THOR simultaneously. Happy to answer questions, especially about
the register map — that part took by far the longest to get right.