Modbus drops connection often on 2023.8.x

Hello, ever since upgrading from 2023.6.x to 2023.8.1 the modbus sensor keeps disconnecting and becomes unavailable. When I restart modbus via developers tools menu then it goes online again for a while. Any idea what might be casuing this? All was OK with previous versions. Updated now to 2023.8.2 to see if it will help…

Here is the modbus config:

modbus:
  - name: TC_Ecodan
    type: tcp
    host: 192.168.x.x
    port: 502
    retry_on_empty: true
    ##timeout: 14
    close_comm_on_error: false
    message_wait_milliseconds: 120
    delay: 5
    sensors:
      - name: TC_Ecodan_Total_Stystem_Power
        unit_of_measurement: W
        address: 52
        input_type: input
        data_type: float32
        #scale: 1
        count: 2
        scan_interval: 3 
        slave: 9
        device_class: power
        precision: 1

Hi @raenji-sk did you ever get a resolution to this? My TCP Modbus also appears to disconnect after a while, it’s been working for years and the only change to my environment is HA version - same as you, a restart in dev tools brings things back up.

Same issue here too. I’m thinking an automation to refresh the yaml might be a solution to whatever HA bodge has been implemented.

Also having the same issue – modbus dropout – with 2023.8.3

same issue here as well, after upgrading to 2023.9

is here someone from ha modbus experts, who knows , what the issue is?

Same for me, started happening after the 2023.9.0 update…

The only error I’m getting is :

Logger: homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:401
Integration: Modbus (documentation, issues)
First occurred: 1:09:04 PM (1 occurrences)
Last logged: 1:09:04 PM

Pymodbus: hub1: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)

1 Like

hi, I have the same problem. I use modbus for my SMA inverter and the sensors goes into unavailable state after some time.

I used the integration over a year without problems and now with the 20.23.9 update I got these errors. Only error I found:

2023-09-10 11:07:51.844 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.modbus
2023-09-10 15:34:27.937 ERROR (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: sma: Modbus Error: [Input/Output] No Response received from the remote slave/Unable to decode response
2023-09-10 20:34:09.546 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 'modbus_hub'
  File "/usr/src/homeassistant/homeassistant/components/modbus/modbus.py", line 236, in async_restart_hub
KeyError: 'modbus_hub'
  File "/usr/src/homeassistant/homeassistant/components/modbus/modbus.py", line 236, in async_restart_hub
KeyError: 'modbus_hub'
2023-09-10 20:34:24.441 INFO (MainThread) [homeassistant.components.modbus] Modbus reloading
2023-09-10 20:34:24.441 WARNING (MainThread) [homeassistant.components.modbus.modbus] modbus sma communication closed
2023-09-10 20:34:24.457 INFO (SyncWorker_10) [homeassistant.components.modbus.modbus] modbus sma communication open

If I reload the modbus service, sensors are available again.

I’m seeing this also now, last few days - I think since updating to 2023.9. Modbus stops after logging these:

2023-09-11 09:37:51.303 ERROR (SyncWorker_14) [homeassistant.components.modbus.modbus] Pymodbus: Iammeter_3_modbus: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)
2023-09-11 09:38:01.307 ERROR (SyncWorker_26) [homeassistant.components.modbus.modbus] Pymodbus: Iammeter_1_modbus: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)

These devices are wifi connected, and occasionally they do drop packets, but it’s never just given up in the past, it’s always recovered quickly.

See TCP modbus connection not restored after device restarted · Issue #100063 · home-assistant/core · GitHub

F.Y.I.: HA 2023.9.2 fixed my issue. Modbus is stable again.

I changed a few settings on my Modbus to Wifi adapter and now it is pretty stable. Running HA 2023.8.4

hi, can you share those settings that helps you to improve the modbus connection !

1 Like

Hi - also interested in what you changed to stabilise things ……