Modbus TCP controlled lights always "unavailable"

I am trying to get lights to work with HA that are controlled over Modbus TCP. The configuration is like

- name: Treppenlicht
  type: rtuovertcp
  host: 192.168.178.47
  port: 502
  timeout: 10
  lights:
    - name: TRLSW
      device_address: 1
      unique_id: TreppenlichSW
      address: 1
      write_type: holding
      verify:
        input_type: holding
        address: 1

But HA has these log lines for it:

2024-06-07 16:55:38.028 DEBUG (MainThread) [homeassistant.components.modbus.modbus] Pymodbus: Treppenlicht: Error: device: 1 address: 1 -> Modbus Error: [Input/Output] ERROR: No response received after 3 retries
2024-06-07 16:55:38.028 WARNING (MainThread) [homeassistant.components.modbus.modbus] modbus Treppenlicht communication closed
2024-06-07 16:55:38.038 INFO (MainThread) [homeassistant.components.modbus.modbus] modbus Treppenlicht communication open
2024-06-07 16:55:44.025 ERROR (MainThread) [pymodbus.logging] Cancel send, because not connected!
2024-06-07 16:55:44.025 DEBUG (MainThread) [homeassistant.components.modbus.modbus] Pymodbus: Treppenlicht: Error: device: 1 address: 1 -> Modbus Error: [Connection] Client is not connected
2024-06-07 16:56:08.029 DEBUG (MainThread) [homeassistant.components.modbus.modbus] Pymodbus: Treppenlicht: Error: device: 1 address: 1 -> Modbus Error: [Input/Output] ERROR: No response received after 3 retries
2024-06-07 16:56:14.027 ERROR (MainThread) [pymodbus.logging] Cancel send, because not connected!

The device is online and responding to Modbus requests from another client program, but does not log any attempt from HA to connect at all.

  • how to find out more details?
  • how to fix that?

[Update]
I added another device, a sensor from a different vendor:

- name: Treppenlicht
  type: rtuovertcp
  host: 192.168.178.47
  port: 502
  lights:
    - name: TRLSW
      device_address: 1
      unique_id: TreppenlichSW
      address: 1
      write_type: holding
      verify:
        input_type: holding
        address: 1
- name: OVAG
  type: rtuovertcp
  host: 192.168.178.77
  port: 6502
  sensors:
    - name: erster
      device_address: 4
      address: 1
      unique_id: erster1
      input_type: holding
      scan_interval: 30

The reaction is identical, though:

2024-06-07 17:36:41.096 INFO (MainThread) [homeassistant.components.modbus.modbus] modbus Treppenlicht communication open
2024-06-07 17:36:41.100 INFO (MainThread) [homeassistant.components.modbus.modbus] modbus OVAG communication open
2024-06-07 17:36:50.274 ERROR (MainThread) [pymodbus.logging] Cancel send, because not connected!
2024-06-07 17:36:50.274 ERROR (MainThread) [homeassistant.components.modbus.modbus] Pymodbus: Treppenlicht: Error: device: 1 address: 1 -> Modbus Error: [Connection] Client is not connected
2024-06-07 17:36:53.277 ERROR (MainThread) [homeassistant.components.modbus.modbus] Pymodbus: OVAG: Error: device: 4 address: 1 -> Modbus Error: [Input/Output] ERROR: No response received after 3 retries

Must be something general, so it seems.

I ran tcpdump -i eth0 in the terminal. There is not a single attempt to reach out to any of the Modbus devices, neither ARP nor IP. All I can see from the outer network ist mDNS multicasts coming in for some repeaters and the packets from/to the Android devices I am using to access HA.

I can even ping the device from the terminal or open a telnet session to it.

So what is wrong with HA?

Nothing is wrong except me being blind…

I used type: rtuovertcp for the devices under the (false) assumption tcp would not accept the device_address parameter.

This led to HA sending a RTU CRC with each request, that was irritating the TCP servers and had the requests dropped there.

As soon as I changed to type: tcp everything worked.

Sorry bothering you… :roll_eyes: