MatterVN / ModbusTCP2MQTT

Sungrow & SMA Solar Inverter addon for Home Assistant using mobusTCP
MIT License
67 stars 50 forks source link

ERROR:pymodbus.factory:index out of range #4

Open mistaoh opened 2 years ago

mistaoh commented 2 years ago

I get the following issue when I try this addon.

INFO:root:Modbus connected
INFO:root:Configured MQTT Client
INFO:root:Publish Home Assistant Discovery message
DEBUG:pymodbus.transaction:Current transaction state - IDLE
DEBUG:pymodbus.transaction:Running transaction 1
DEBUG:pymodbus.transaction:SEND: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x88 0x0 0x64
DEBUG:pymodbus.client.sync:New Transaction state 'SENDING'
DEBUG:pymodbus.transaction:Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
DEBUG:pymodbus.transaction:Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
DEBUG:pymodbus.transaction:RECV: 0x0 0x1 0x0 0x0 0x0 0x2 0x1 0x84 0x2
DEBUG:pymodbus.framer.socket_framer:Processing: 0x0 0x1 0x0 0x0 0x0 0x2 0x1 0x84 0x2
DEBUG:pymodbus.factory:Factory Response[132]
ERROR:pymodbus.factory:index out of range
ERROR:pymodbus.transaction:Modbus Error: [Input/Output] Unable to decode request
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/pymodbus/transaction.py", line 190, in execute
    self.client.framer.processIncomingPacket(response,
  File "/usr/lib/python3.9/site-packages/pymodbus/framer/socket_framer.py", line 153, in processIncomingPacket
    self._process(callback)
  File "/usr/lib/python3.9/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
WARNING:root:Modbus connection failed
WARNING:root:Failed to scrape inverter, sleeping until next scan
DEBUG:pymodbus.transaction:Current transaction state - TRANSACTION_COMPLETE
DEBUG:pymodbus.transaction:Running transaction 2
DEBUG:pymodbus.transaction:Clearing current Frame : - 0x0 0x1 0x0 0x0 0x0 0x2 0x1 0x84 0x2
DEBUG:pymodbus.transaction:SEND: 0x0 0x2 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x88 0x0 0x64
DEBUG:pymodbus.client.sync:New Transaction state 'SENDING'
DEBUG:pymodbus.transaction:Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
DEBUG:pymodbus.transaction:Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
DEBUG:pymodbus.transaction:RECV: 0x0 0x2 0x0 0x0 0x0 0x2 0x1 0x84 0x2
DEBUG:pymodbus.framer.socket_framer:Processing: 0x0 0x2 0x0 0x0 0x0 0x2 0x1 0x84 0x2
DEBUG:pymodbus.factory:Factory Response[132]
ERROR:pymodbus.factory:index out of range
ERROR:pymodbus.transaction:Modbus Error: [Input/Output] Unable to decode request
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/pymodbus/transaction.py", line 190, in execute
    self.client.framer.processIncomingPacket(response,
  File "/usr/lib/python3.9/site-packages/pymodbus/framer/socket_framer.py", line 153, in processIncomingPacket
    self._process(callback)
  File "/usr/lib/python3.9/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
WARNING:root:Modbus connection failed
WARNING:root:Failed to scrape inverter, sleeping until next scan

Any ideas on what is wrong.

It´s a Sungrow SG10RT connected via a sungrow WiNet-S wifi module. Please let me know what additional information I should provide. Addon version is 0.2

bohdan-s commented 2 years ago

Hi, I have the same issues https://github.com/meltaxa/solariot/issues/53 I am guessing it is an issue with the new WiNet-S dongles? They may be using a new encryption?

bohdan-s commented 2 years ago

I raised a issue over here: https://github.com/rpvelloso/Sungrow-Modbus/issues/8 It seems to be an issue with the WiNet-S dongle. Would you be able to check what firmware your dongle is? mine is: M_WiNet-S_V01_V01_A

mistaoh commented 2 years ago

Would you be able to check what firmware your dongle is? mine is: M_WiNet-S_V01_V01_A

My wifi dongle version is M_WiNet-S_V01_V01_A as well.

MarkGardiner commented 2 years ago

Just to kick things along,

@bohdan-s I notice you have managed to work some magic in https://github.com/bohdan-s/SungrowModbusWebClient . I assume that is the best fix we can hope for for this specific issue at the moment?

Any change that @bohdan-s 's approach could be a configuration option for this addon where direct modbus access is blocked?

bohdan-s commented 2 years ago

I will submit a PR this week to enable using the HTTP request module :)

MarkGardiner commented 2 years ago

Thank you! Very excited to try it out.

cartman10 commented 1 year ago

Did somebody resolve the issue ? I'm having the same problem... Or are you using the fix from bohdan-s ?

MarkGardiner commented 1 year ago

I am essentially using the fix from @bohdan-s above in the SunGather release https://github.com/bohdan-s/SunGather which works perfectly for what I want. I had to set the "connection: http" which as I understand uses his fix above and gets the registers over a websocket connection rather than actually via the Modbus TCP connection.