Modbus Error with Core Version > 2024.3.3

I am using a USB2Serial (RS485) adapter to get data from an energy meter, what has worked well for month.

After Updating HA-OS from 12.0 to 12.2 (and HA-Core from 2024.3.3 (not sure) to 2024.4.3), I can’t connect my USB2Serial-Adapter. Everything in HA looks fine, as far as I can see, but I get the following error:

Logger: homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:318
integration: Modbus (documentation, issues)
First occurred: 15:16:56 (2 occurrences)
Last logged: 15:18:57

Pymodbus: EM_Heizung: Error: device: 0 address: 1024 -> Modbus Error: [Input/Output] ERROR: No response received after 3 retries
Pymodbus: EM_Heizung: Error: device: 0 address: 1056 -> Modbus Error: [Input/Output] ERROR: No response received after 3 retries

I have tried to change from USB0 to USB1, also different baudrates, nothing works.

I have disconnected the USB adapter from the HA and connected it to my Windows PC and read out data from the same device (energy meter), which worked perfectly.

Here is my yaml-configuration:

modbus:

  • name: EM_Heizung
    type: serial
    port: /dev/ttyUSB0
    baudrate: 115200
    bytesize: 8
    method: rtu
    parity: N
    stopbits: 1
    delay: 0
    message_wait_milliseconds: 30
    timeout: 5

Here is my hardware-configuration:

ttyUSB0 /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0

Subsystem: tty
Device path: /dev/ttyUSB0
ID: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0

DEVLINKS: >-
/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
/dev/serial/by-path/pci-0000:00:06.1-usb-0:2:1.0-port0
/dev/serial/by-path/pci-0000:00:06.1-usbv1-0:2:1.0-port0
DEVNAME: /dev/ttyUSB0
DEVPATH: /devices/pci0000:00/0000:00:06.1/usb3/3-2/3-2:1.0/ttyUSB0/tty/ttyUSB0
ID_BUS: usb
ID_MODEL: USB_Serial
ID_MODEL_ENC: USB\x20Serial
ID_MODEL_ID: β€˜7523’
ID_PATH: pci-0000:00:06.1-usb-0:2:1.0
ID_PATH_TAG: pci-0000_00_06_1-usb-0_2_1_0
ID_PATH_WITH_USB_REVISION: pci-0000:00:06.1-usbv1-0:2:1.0
ID_REVISION: β€˜0264’
ID_SERIAL: 1a86_USB_Serial
ID_TYPE: generic
ID_USB_DRIVER: ch341
ID_USB_INTERFACES: β€˜:ff0102:’
ID_USB_INTERFACE_NUM: β€˜00’
ID_USB_MODEL: USB_Serial
ID_USB_MODEL_ENC: USB\x20Serial
ID_USB_MODEL_ID: β€˜7523’
ID_USB_REVISION: β€˜0264’
ID_USB_SERIAL: 1a86_USB_Serial
ID_USB_TYPE: generic
ID_USB_VENDOR: 1a86
ID_USB_VENDOR_ENC: 1a86
ID_USB_VENDOR_ID: 1a86
ID_VENDOR: 1a86
ID_VENDOR_ENC: 1a86
ID_VENDOR_ID: 1a86
MAJOR: β€˜188’
MINOR: β€˜0’
SUBSYSTEM: tty
TAGS: β€˜:systemd:’
USEC_INITIALIZED: β€˜9600961691’

Is there something I can’t see? And what do the addresses 1024 and 1056 in the error message mean?

I’m guessing the integration was set-up with you connecting to a specific serial port like

You should be able to set it up using the id of the device instead, then no matter what serial port the OS assigns it to at reboot, it will find it.
I don’t know exactly with that integration, but all the zwave, zigbee, bluetooth integrations I’ve used this works.

Probably something like one of these.

I have tried this, but using the ID (in modbus.yaml) does not work and terminates other modbus integrations (tcp) additionally.
I am actually sure that I am using the correct USB port, depending on which one the adapter is currently using (/dev/ttyUSB0 or /dev/ttyUSB1). I think that is not the problem. I am aware of the problem because I also have a Sonoff Zigbee USB adapter in use and sometimes the two switch USB ports. There are no problems with the Sonoff USB-Adapter.

1 Like

There seems to be a problem with the new update of the Core. I have downgraded to version 2024.3.3

On CLI:
ha core update --version 2024.3.3

and now the integration is running smoothly again.

and fixed in 2024.4.4 (according to the release notes)

I am also reading data from my energy meter with modbus, in my case I am using USR-DR302 to convert from modbus to TCP and with type: rtuovertcp as modbus in configuration.

And In my situation even after upgrading to 2024.4.4 I still can’t read data from energy meter.

Downgrading to 2024.3.3 fixes it :frowning:

This is my log file on 2024.4.4:

2024-04-26 19:40:02.114 DEBUG (MainThread) [homeassistant.components.modbus.modbus] Pymodbus: inepro380: Error: device: 0 address: 20482 -> Modbus Error: [Input/Output] ERROR: No response received after 3 retries
2024-04-26 19:40:02.115 DEBUG (MainThread) [pymodbus.logging] Wait comm 100.0 ms before reconnecting.
2024-04-26 19:40:02.146 DEBUG (MainThread) [homeassistant.components.modbus.modbus] Pymodbus: inepro380: Error: device: 0 address: 20484 -> Modbus Error: [Connection] Not connected[AsyncModbusTcpClient 10.10.1.221:23]
2024-04-26 19:40:02.179 DEBUG (MainThread) [homeassistant.components.modbus.modbus] Pymodbus: inepro380: Error: device: 0 address: 20486 -> Modbus Error: [Connection] Not connected[AsyncModbusTcpClient 10.10.1.221:23]
2024-04-26 19:40:02.211 DEBUG (MainThread) [homeassistant.components.modbus.modbus] Pymodbus: inepro380: Error: device: 0 address: 20492 -> Modbus Error: [Connection] Not connected[AsyncModbusTcpClient 10.10.1.221:23]
2024-04-26 19:40:02.266 DEBUG (MainThread) [pymodbus.logging] Connecting to 10.10.1.221:23.
2024-04-26 19:40:02.267 DEBUG (MainThread) [pymodbus.logging] Connecting comm
2024-04-26 19:40:02.273 DEBUG (MainThread) [homeassistant.components.modbus.modbus] Pymodbus: inepro380: Error: device: 0 address: 20494 -> Modbus Error: [Connection] Not connected[AsyncModbusTcpClient 10.10.1.221:23]
2024-04-26 19:40:02.277 DEBUG (MainThread) [pymodbus.logging] Connected to comm

@Iceman03, could you please check it your issue has been fixed with 2024.4.4, please?

I have tried today. 2024.4.4 did not fix the issue. Going back to 2024.3.3 now.

Using Core 2024.5.1 and Operating System 12.2
Using Modbus via TCP, still have the same issue.

I agree! I have tried 2024.5.1 today. Did not fix the problem for me.

Version 2024.5.1 provides irregular values, but the entities still change to unavailable.

Hi
Observing the same issue with ControlByWeb device X410-I. Modbus communication is working fine most of the time, but every few hours, I get:
2024-05-09 11:19:58.003 ERROR (MainThread) [homeassistant.components.modbus.modbus] Pymodbus: modbus_CbW: Error: device: 1 address: 1024 β†’ Modbus Error: [Connection] Not connected[AsyncModbusTcpClient 192.168.2.57:502]

My config is:

- name: modbus_CbW
  type: tcp
  host: 192.168.2.57
  port: 502
  delay: 2
  message_wait_milliseconds: 300
  timeout: 15
  sensors:
    - name: "EV Energy Total"
      address: 1024
      input_type: holding
      data_type: float32
      offset: 0
      scale: 0.001
      precision: 3
      scan_interval: 60
      slave: 1
      unique_id: ModbusCBW_AutoVerbruik
      device_class: energy
      unit_of_measurement: "kWh"
      state_class: total

Running HA on Debian 12 supervised mode:

* Core2024.5.2
* Supervisor2024.05.1
* Operating System
* Frontend20240501.1

Using 2024.5.5
I am unable to connect to Modbus.
Is the problem still prevalent?

Thank you!

I was absent for 2 weeks. Yesterday I tried 2024.6.2, the problem is still the same, for me.

Bug was found today, hopefuly there will be soon an update of pymodbus in one of the next versions of HA Core. The error should then be rectified.