michbeck100 / pv-monitoring

Contains configuration and Grafana dashboard for monitoring PV inverters
Apache License 2.0
43 stars 11 forks source link

Index Out of Range & Modbus Error: [Input/Output] Unable to decode request #3

Closed dmindfuse closed 1 year ago

dmindfuse commented 1 year ago

Hi. All my containers appear to be running fine when deployed, with the exception of the Sungather container, which outputs the following log data:

023-04-05 11:52:27 INFO Starting SunGather 0.5.1 2023-04-05 11:52:27 INFO Need Help? https://github.com/bohdan-s/SunGather 2023-04-05 11:52:27 INFO NEW HomeAssistant Add-on: https://github.com/bohdan-s/hassio-repository 2023-04-05 11:52:27 INFO Loaded config: /config/config.yaml 2023-04-05 11:52:27 INFO Loaded registers: registers-sungrow.yaml 2023-04-05 11:52:27 INFO Registers file version: 0.2.3 2023-04-05 11:53:01 ERROR index out of range index out of range 2023-04-05 11:53:01 ERROR Modbus Error: [Input/Output] Unable to decode request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/pymodbus/transaction.py", line 208, in execute self.client.framer.processIncomingPacket(response, File "/usr/local/lib/python3.11/site-packages/pymodbus/framer/socket_framer.py", line 153, in processIncomingPacket self._process(callback) File "/usr/local/lib/python3.11/site-packages/pymodbus/framer/socket_framer.py", line 175, in _process raise ModbusIOException("Unable to decode request") pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request Modbus Error: [Input/Output] Unable to decode request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/pymodbus/transaction.py", line 208, in execute self.client.framer.processIncomingPacket(response, File "/usr/local/lib/python3.11/site-packages/pymodbus/framer/socket_framer.py", line 153, in processIncomingPacket self._process(callback) File "/usr/local/lib/python3.11/site-packages/pymodbus/framer/socket_framer.py", line 175, in _process raise ModbusIOException("Unable to decode request") pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request 2023-04-05 11:53:01 WARNING Modbus connection failed Modbus connection failed 2023-04-05 11:53:31 WARNING Modbus connection failed Modbus connection failed

I'm not sure what's wrong here. I changed the top lines of the Sungather config to this, but it did not help:

inverter:
  host: modbus-proxy                
  port: 502                               
  timeout: 30                             
  #retries: 3                              
  # slave: 0x01                         
  scan_interval: 10                   
  connection: modbus            
  model: "SH8.0RT"

And my modbus-proxy config is set to:

devices:
  - modbus:
      url: 10.10.10.44:502
    listen:
      bind: 0:502

By contrast, modbus-proxy logs seem OK:

2023-04-05 09:52:23,732 INFO modbus-proxy: Starting... 2023-04-05 09:52:23,752 INFO modbus-proxy.ModBus(10.10.10.44:502): Ready to accept requests on 0:502 2023-04-05 09:52:27,981 INFO modbus-proxy.Client(172.22.0.7:58541): new client connection 2023-04-05 09:52:30,989 INFO modbus-proxy.ModBus(10.10.10.44:502): connecting to modbus... 2023-04-05 09:52:30,992 INFO modbus-proxy.ModBus(10.10.10.44:502): connected! 2023-04-05 09:52:31,000 INFO modbus-proxy.Client(172.22.0.7:58541): client closed connection 2023-04-05 09:52:31,001 INFO modbus-proxy.Client(172.22.0.7:58541): closing connection... 2023-04-05 09:52:31,001 INFO modbus-proxy.Client(172.22.0.7:58541): connection closed 2023-04-05 09:52:31,091 INFO modbus-proxy.Client(172.22.0.7:35029): new client connection 2023-04-05 09:53:01,169 INFO modbus-proxy.Client(172.22.0.7:35029): client closed connection 2023-04-05 09:53:01,173 INFO modbus-proxy.Client(172.22.0.7:35029): closing connection... 2023-04-05 09:53:01,174 INFO modbus-proxy.Client(172.22.0.7:35029): connection closed 2023-04-05 09:53:01,175 INFO modbus-proxy.Client(172.22.0.7:45109): new client connection 2023-04-05 09:53:31,182 INFO modbus-proxy.Client(172.22.0.7:45109): client closed connection 2023-04-05 09:53:31,183 INFO modbus-proxy.Client(172.22.0.7:45109): closing connection... 2023-04-05 09:53:31,184 INFO modbus-proxy.Client(172.22.0.7:45109): connection closed 2023-04-05 09:53:31,184 INFO modbus-proxy.Client(172.22.0.7:51817): new client connection 2023-04-05 09:54:01,215 INFO modbus-proxy.Client(172.22.0.7:51817): client closed connection 2023-04-05 09:54:01,215 INFO modbus-proxy.Client(172.22.0.7:51817): closing connection... 2023-04-05 09:54:01,216 INFO modbus-proxy.Client(172.22.0.7:51817): connection closed 2023-04-05 09:54:01,219 INFO modbus-proxy.Client(172.22.0.7:49261): new client connection 2023-04-05 09:54:31,244 INFO modbus-proxy.Client(172.22.0.7:42583): new client connection 2023-04-05 09:55:01,276 INFO modbus-proxy.Client(172.22.0.7:46791): new client connection ....goes on forever

Is this an issue with my deployment, or with the inverter, or with modbus or sungather? I'm not sure where to look or what to do with that "index out of range"; is the reason why modbus fails with a traceback and which index is out of range where?

Any help is greatly appreciated. Thanks.

michbeck100 commented 1 year ago

If you open the sungather web page at port 8080, do you see anything here? You can also activate the logging to console using log_console: INFO

dmindfuse commented 1 year ago

Hi. I found a solution to the issue at https://github.com/bohdan-s/SunGather/issues/40#issuecomment-1214442962 , which advises to use http instead of modbus connection: with an SH8.0RT. I have also forced this configuration to be able to read from the inverter and I had to configure the IP of the inverter in sungather's config instead of modbus-proxy, then set the port underneath to 8082 as documented in the config comments . I disabled modbus-proxy in the main docker yaml as advised. It now works! Thanks for the pointers!

michbeck100 commented 1 year ago

I close this issue then