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!
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
Side question, did you just plug that relay module in and IP was detected automatically?
I just received one and plugging it into my network it doesnt get an ip assigned.
Is there some sort of magic preconfiguration required?
The device does not get an DHCP IP address by default - it is assigned the IP 192.168.1.200. I followed the guide below to download the VirCom software, which saw the relay on the network and then I enabled DHCP for IP addressing. Worked great!
Hi all, first post in this forum for me and hoping on some support from the team here.
I have a similar issue with the Waveshare POE Eth Relay module.
it looks like my communication to the module is working as both the Rxd & Txd led are flashing once I send a command out of HA to toggle the relay. (this is not working if any of the communication parameters would change)
Home assistant is also getting the feedback that the relay has been switched although it has not.
It looks like my waveshare module is in linkage mode (when triggering an input the corresponding output relay will also trigger with led indication)
with SSCOM I tried to disable the linkage mode by sending the following command;
Use sscom to send the neccesary command. Then use HA to toggle relays or Modbus Poll.
0x0000:Normal mode,relays are directly controlled by commands;
0x0001: Linkage mode,relay status is consistent with the corresponding input channel status;
0x0002:Toggle mode,a pulse in the input channel toggles the relay state once;
0x0003: Edge mode,an edge change in the input channel toggles the relay state once
To set all relays to Toggle Mode (control mode 0x0002) using Modbus TCP, the command needs to write the value 0x0002 to all 8 registers starting at 0x1000.
Most probably the assumption that Modbus RTU protocol is the default most will use. So giving the tools / explanation on the wiki to convert RTU to TCP is sufficient.
But like all of us, we want a one stop solution!
Waveshare have so many products that do similar things, so easier to copy and paste I reckon.
Glad it’s all working now, was banging my head against my desk for a while then it clicked.
I know the last post is quiet old. But in case someone else is having trouble with the POE TCP Modbus relay: On my side I couldn’t get the readout work reliably. When resetting the device via the “DEF” pin, the TCP modbus readout would work but after setting a custom IP, it would no longer work.
Please note that this version cannot be downgraded anymore. For details on the upgrade process, please refer to the manual (page 49 to 52).
After upgrading, the webinterface has to be re-downloaded to the device.
That works for me for the B Poe ETH module. It goes in the lower right white space of SSCOM and hit send when you are connected. Then everything worked in case anyone was confused like I was.
Only issue is unque Id’s aren’t working, HA makes them, not sure why. But inputs work with 1 second delay, relays all work pretty fast. (I have the A and B Module, A is Waveshare 1, B is waveshare 2.
Anyone who knows how to get unique id’s fixed feel free to fix my code. BTW Toggle mode I believe will toggle the relay when B module input detects signal, so you need normal mode. Now I can use it to detect like my fire alarm or 8 inputs.
Archades previous post was the only thing I could find on the entire internet that worked for getting my digital inputs working. (chatgpt had been telling me to set “input_type:discrete” instead of “input_type:discrete_input” for the binary_sensors section).
I didn’t update my firmware (V1. 486) and everything seemed to get working now.
Could you elaborate on the steps it took to get this working? How complicated is all this?
I am looking at buying one of these boards to automate my irrigation system in HA, but from this thread as well as the seemingly crazy complicated instructions on the waveshare wiki I’m wary whether I’ll get this working with my very limited coding / networking knowledge.
Where does all this code go that was posted in the thread?
For anyone looking for the solution to this, I found a video explaining all the steps to get this working - its in italian, but youtubes CC will translate it well. Following this, it was super easy to get it all working.
I copied the following code into my config file. You’ll have to adjust the IP you set using the VirCOM and you can obviously adjust the names to whatever you want. For me this going to be an irrigation controller, so they are valves.