core: modbus callback_data problem
The problem
After update to core-2024.4.3, still the same problem that started after core update to 2024.4.0, see #115114, #115236, #115348 core-2024.4.3 solved the problems unfortunately not yet. Even a complete reboot of the system did not help.
Python-Version 3.12.2 Linux 6.1.73-haos-raspi aarch64 Home Assistant OS 12.2 stable supervisor-2024.04.0
What version of Home Assistant Core has the issue?
core-2024.4.3
What was the last working version of Home Assistant Core?
core-2024.3.3
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
modbus_sungrow.yaml
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
I am using
https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/blob/main/modbus_sungrow.yaml
without changes.
Version from 2024-04-05
Anything in the logs that might be useful for us?
Logger: pymodbus.logging
Quelle: runner.py:189
Erstmals aufgetreten: 14:13:28 (152 Vorkommnisse)
Zuletzt protokolliert: 19:33:37
General exception: index out of range
**Followed each time by this error:**
Logger: homeassistant
Quelle: /usr/src/homeassistant/homeassistant/runner.py:146
Erstmals aufgetreten: 14:13:28 (152 Vorkommnisse)
Zuletzt protokolliert: 19:33:37
Error doing job: Fatal error: protocol.data_received() call failed.
Traceback (most recent call last):
File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 1017, in _read_ready__data_received
self._protocol.data_received(data)
File "/usr/local/lib/python3.12/site-packages/pymodbus/transport/transport.py", line 302, in data_received
self.datagram_received(data, None)
File "/usr/local/lib/python3.12/site-packages/pymodbus/transport/transport.py", line 336, in datagram_received
cut = self.callback_data(self.recv_buffer, addr=addr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymodbus/client/base.py", line 207, in callback_data
self.framer.processIncomingPacket(data, self._handle_response, slave=0)
File "/usr/local/lib/python3.12/site-packages/pymodbus/framer/base.py", line 139, in processIncomingPacket
self.frameProcessIncomingPacket(single, callback, slave, **kwargs)
File "/usr/local/lib/python3.12/site-packages/pymodbus/framer/socket_framer.py", line 110, in frameProcessIncomingPacket
raise ModbusIOException("Unable to decode request")
pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 6
- Comments: 20 (6 by maintainers)
Found the problem, we receive:
0x02 is the length, but it is followed by 3 bytes, which means we miss the last byte.
The standard defines " The length field is a byte count of the following fields, including the Unit Identifier and data fields." which means it should be 3 !!! so the device is NOT following the standard.
To be honest I have however seen this problem in a number of devices, so I will adapt pymodbus to allow for this non standard behavior.
There are currently NO timeline for a fix, but it is likely to to be in 2024.5.
@janiversen I think this is the same problem I was experiencing that I had commented in another thread. For what it’s worth, I had a stable configuration working completely well since at least 2022 and the only change was updating to 2024.4. I wonder what in the code changed that made this non standard output throw an error when it did not before…
Unfortunately the problem still exists here too. Because of all the changes were done in the last versions, I created a new logfile with version 2024.4.4.
Configuration:
Logfile: