Modbus Proxy need help to understand configuration

Hello
I have problems to configure the AddOn Modbus Proxy.
I have 2 Devices, which are connected to HA over modbus-TCP:

  • Solvis Heatpump
  • Sungrow Inverter with battery

I see from both the values, but sometime, i have errors in my log about modbus

Logger: homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:403
Integration: Modbus (documentation, issues)
First occurred: 16:47:40 (442 occurrences)
Last logged: 18:02:03

Pymodbus: SungrowSHx: Modbus Error: [Input/Output] [Errno 32] Broken pipe
Pymodbus: SungrowSHx: Modbus Error: [Input/Output] [Errno 104] Connection reset by peer
Pymodbus: solvisremote: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)

I I thought the Modbus Proxy is the Solution. There is in the Configuration one entry “upstreamhost”. Is it the IP from my HA or from one Modbus-Slave (so I understand some discussion).

If it is my HA, what is the way, that the Proxy works?

upstreamhost: 192.168.178.56
upstreamport: 502
listenport: 502
connection_time: 0.1
timeout: 10
loglevel: INFO
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
Preparing to run modbus-proxy
Upstream: 192.168.178.56:502
Listen: 502
Timeout: 10
Connection Time: 0.1
Loglevel: INFO
Generated Config
devices:
  - modbus:
      url: 192.168.178.56:502 # device url (mandatory)
      timeout: 10 # communication timeout (s) (optional, default: 10)
      connection_time: 0.1 # delay after connection (s) (optional, default: 0)
    listen:
      bind: 0:502 # listening address (mandatory)
logging:
  version: 1
  formatters:
    standard:
      format: "%(asctime)s %(levelname)8s %(name)s: %(message)s"
  handlers:
    console:
      class: logging.StreamHandler
      formatter: standard
  root:
    handlers: ['console']
    level: INFO
2023-06-11 18:12:23,853     INFO modbus-proxy: Starting...
2023-06-11 18:12:23,857     INFO modbus-proxy.ModBus(192.168.178.56:502): Ready to accept requests on 0:502

Thank you for your help.

Did you get it working/resolve the errors? If you have two separate RS485 TCP modbus strings and two TCP-bridges, you would not need a modbus-proxy. But, if the heatpump is communicating with the inverter over modbus (so you have only one bus), and you want to pull the inverter registers also, yes, then you need a proxy, as only one device can pull registers from servers on that bus, or you get “garbage” :wink:.
I couldn’t get any modbus/tcp-proxy working - you can try my own implementation here: Another tcp-proxy addon for modbus tcp or anything else - Share your Projects! - Home Assistant Community (home-assistant.io)

Cheers - cosote.

Hello,
i ask for a friend :wink:
I have an Sungrow inverter and ask the inverter from HA for the Energy values and at the same time from the EVCC add on. So i have some Infos in the log like this:
“Pymodbus: SungrowSHx: Modbus Error: [Connection] ModbusTcpClient(192.168.178.191:502): Connection unexpectedly closed 0.0006783008575439453 seconds into read of 8 bytes without response from slave before it closed connection”
can i avoid this by using the Modbus proxy?