Skip to content

Sharing the Inverter with Other Programs

hilman2 edited this page Sep 1, 2026 · 1 revision

Sharing the inverter with other programs

Most SunSpec inverters accept one Modbus TCP connection. This integration holds it open, because that is what the inverters cope with best. If something else needs to read the same inverter, evcc, openHAB, Solar-Log, a monitoring script, a second Home Assistant, or Home Assistant's own Modbus integration for a register this integration does not expose, put a Modbus proxy in between. The proxy holds the one connection to the inverter and accepts as many clients as you like.

The Release the Modbus connection between polls option is the other answer, and the worse one. It rebuilds the session every poll, which is the thing an embedded Modbus stack handles worst, and two programs taking turns on one slot still collide. Use it only when a proxy is impossible. Troubleshooting in detail has the numbers.

Several config entries of this integration on one inverter need neither. They take turns by themselves.

Option A: the Home Assistant add-on

For Home Assistant OS and Supervised. Akulatraxas/ha-modbusproxy packages the proxy below as an add-on.

  1. Settings -> Add-ons -> Add-on store -> three-dot menu -> Repositories, add https://github.com/Akulatraxas/ha-modbusproxy
  2. Install ModBusProxy and open its configuration:
upstreamhost: 192.168.1.50
upstreamport: 502
listenport: 5020
loglevel: INFO
  1. Start it, and tick Start on boot.

upstreamhost and upstreamport are the inverter. listenport is where the proxy listens on the Home Assistant host. Several inverters go into the devices list, each with its own listen port; the add-on page shows the format.

Option B: modbus-proxy anywhere else

tiagocoutinho/modbus-proxy is the program behind the add-on. It runs on anything with Python, a Raspberry Pi next to the inverter included.

pip install "modbus-proxy[yaml]"

A configuration file, modbus-proxy.yml:

devices:
  - modbus:
      url: 192.168.1.50:502
      timeout: 10
      connection_time: 0.1
    listen:
      bind: 0:5020

Run it with the file, or without one for a single inverter:

modbus-proxy -b tcp://0:5020 --modbus tcp://192.168.1.50:502

Its README has the Docker build and a systemd example. A second inverter is a second entry under devices with another bind port.

connection_time is a pause after connecting before the first request goes out. Some inverters need it; 0.1 s is a safe default.

Pointing everything at the proxy

This integration: Settings -> Devices & Services -> SunSpec Modbus -> three-dot menu -> Reconfigure. Enter the proxy's host and port; the unit ID stays what it was. The integration checks that the device behind the new address reports the same serial number before it accepts the change, so your entities and history stay.

Everything else: the proxy's host and port as well, same unit ID. Nothing should talk to the inverter directly any more; the proxy's one connection is the only one the inverter sees.

Restart the proxy once after the switch. If it had already been refused by the inverter while the integration still held the slot, it may be sitting in a reconnect loop.

What to expect

  • Latency goes up by a few milliseconds per request. The integration does not notice.
  • Writes work through the proxy. The KACO owner in #17 drove the export limit that way for two years.
  • The proxy is now the single point of failure. If it dies, every client loses the inverter at once. The add-on's watchdog, or a systemd Restart=always, is worth the two minutes.
  • Two config entries through one proxy still take turns inside the integration, because the lock is keyed by host and port and both now point at the proxy. Harmless: the proxy serialises them anyway.

Two Home Assistant instances

Same setup. Each instance gets its own config entry pointing at the proxy. Only one of them should run the write controls; two control loops on one export limit undo each other's work.

Clone this wiki locally