Help with Waveshare POE TCP Modbus Relay configuration

I have a Waveshare 8-channel Modbus POE ETH Relay and I’m really struggling with getting it integrated into Home Assistant.

I know the IP address is correct and the port is what I see in the web UI. I have been able to connect in python directly using pymodbus TCP client, but I can’t get the relays to toggle on\off using HA or in the Python REPL with pymodbus.

This is my test config using relay 8.

modbus:
  - name: waveshare_relay
    type: tcp
    host: 192.168.0.107  # Replace with your device's IP address
    port: 4196           # Replace with your device's port
    binary_sensors:
      - name: relay_1_status
        slave: 1
        address: 0
        input_type: coil
        scan_interval: 5
    switches:
      - name: relay_1
        slave: 1
        address: 0
        write_type: coil

Has anyone used this device before and configured it successfully? I’m really at a loss after several hours of different attempts. ty!

Some logs for this…

2024-05-19 13:40:18.364 INFO (MainThread) [homeassistant.setup]
    Setting up modbus
2024-05-19 13:40:18.376 INFO (MainThread) [homeassistant.setup]
    Setting up switch
2024-05-19 13:40:18.378 INFO (MainThread) [homeassistant.setup]
    Setup of domain switch took 0.00 seconds
2024-05-19 13:40:18.381 INFO (MainThread) [homeassistant.setup]
    Setup of domain modbus took 0.02 seconds
2024-05-19 13:40:18.388 INFO (MainThread) [homeassistant.components.modbus.modbus]
    modbus waveshare_relay communication open
2024-05-19 13:40:29.088 INFO (MainThread) [homeassistant.components.binary_sensor]
    Setting up modbus.binary_sensor
2024-05-19 13:40:29.092 INFO (MainThread) [homeassistant.components.switch] 
    Setting up modbus.switch
2024-05-19 13:40:42.084 ERROR (MainThread) [homeassistant.components.modbus.modbus]
    Pymodbus: waveshare_relay:
    Error: device: 1 address: 0 -> Modbus Error: [Input/Output] 
    ERROR: No response received after 3 retries

My device config from VirCOM looks like this.

And the device Web UI shows the same.

Removing the sensor section fixed it… this works.

modbus:
  - name: waveshare_relay
    type: tcp
    host: 192.168.0.107  # Replace with your device's IP address
    port: 502           # Replace with your device's port
    switches:
      - name: Relay 1
        address: 0
        slave: 1
        write_type: coil
      - name: Relay 2
        address: 1
        slave: 1
        write_type: coil
      - name: Relay 3
        address: 2
        slave: 1
        write_type: coil
      - name: Relay 4
        address: 3
        slave: 1
        write_type: coil
      - name: Relay 5
        address: 4
        slave: 1
        write_type: coil
      - name: Relay 6
        address: 5
        slave: 1
        write_type: coil
      - name: Relay 7
        address: 6
        slave: 1
        write_type: coil
      - name: Relay 8
        address: 7
        slave: 1
        write_type: coil
1 Like