Modbus connection errors: how to manage from the high level

Hi guys,
I’m observing frequent modbus communication errors and I’d like to understand how to manage them from the automation level.
Such an error is becoming really frequent, so a good point could be understanding why it happens, but, of course, also how to manage and restart the system to make the connection available again.
This is the error:

023-12-15 16:12:13.898 DEBUG (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: hub_termica: Error: device: 25 address: 28317 -> Modbus Error: [Connection] Failed to connect[ModbusSerialClient(<pymodbus.framer.rtu_framer.ModbusRtuFramer object at 0x7fbf9a8a6090> baud[9600])]

ModBus_Error

Moreover, I’m registering also a different kind of error, minor I suppose that it is this one:

2023-12-17 15:04:54.708 ERROR (SyncWorker_10) [homeassistant.components.modbus.modbus] Pymodbus: hub_termica: Error: device: 23 address: 46801 -> pymodbus returned isError True 2023-12-17 15:05:27.789 ERROR (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: hub_termica: Error: device: 20 address: 28311 -> Modbus Error: [Input/Output] No Response received from the remote slave/Unable to decode response

any ideas?

I’m assuming that perhaps you are either too fast at polling or you are getting occasional corruption.

I think the modbus options for the modbus component can be modified to slow down or handle errors more gracefully.

I don’t remember the options at the moment. Are you receiving the expected register information? If you are and the error is occasionally occurring, then I suspect one or the other is happening.

Thanks for the interest swill008!
With regards the first problem, I understand that it is a USB connection error… I have to understand how to restart the driver in that case.

With regards the second one, I have those random errors on the communication related to different devices (9 devices connected to the hub). This happens after a while.
You say polling time… Maybe.
But I don’t understand how the HA modbus component manages the queue and the channel, so I’m not able to apply a correction.
Is the channel open/closed or is it always open? There is a way to change that behaviour?
My entities requests the state every 15 seconds, is it too fast?

1 Like

Hello,

I have same problem you described:
2024-02-10 21:26:09.034 ERROR (SyncWorker_8) [homeassistant.components.modbus.modbus] Pymodbus: SungrowSHx: Error: device: 1 address: 5725 → pymodbus returned isError True

Every 10 seconds, for different addresses.

Have you found a solution for this in the meantime?

Thanks in advance for any feedback.

Home Assistant

Core 2024.2.1
Supervisor 2024.01.1
Operating System 11.5
Frontend 20240207.1

I think I answered it myself.
My integration file contains queries for my inverter, which presumably cannot exist there yet because the system is too new:
Annual kWH export, months March to December, etc.