I am new to Home Assistant and I want to connect via “Modbus MTUoverTCP” a China relay board
with 2 inputs and 2 outputs. Following HA-Modbus integration documentation I create a new section
in the config file only for 2 relay outputs:
modbus:
- name: “WiFi_RS485_Gateway”
type: rtuovertcp
host: 192.168.88.152
port: 8899
delay: 5
timeout: 2
switches:- name: RS484_Board255_Sw1
slave: 255
address: 0
write_type: coil
command_on: 255
command_off: 0
verify:
input_type: coils
address: 0 - name: RS484_Board255_Sw2
slave: 255
address: 1
write_type: coil
command_on: 255
command_off: 0
- name: RS484_Board255_Sw1
Only with this, I can turn On and Off 2 relays perfectly, but I do have a problem with the verification!
The problem is coming because checking the condition on/off for these relays using “verify” with:
verify:
input_type: coils
address: 0
it works for Relay#1 (name: RS484_Board255_Sw1)!
But it does not work for Relay#2 (name: RS484_Board255_Sw1) if I use verify like that:
verify:
input_type: coils
address: 1
on that my board not responding.
My Relay Board using for all relays (1 and 2) conditions only one address “0”,
Reading it in the response, there is a byte XX (8 bits) and 1st and 2nd bits of it is giving us the relay conditions: 0 - 1off/2off; 1- 1on/2off; 2 - 1off/2on; 3 - 1on/2on
Proper MTU command for reading relay condition on board with address FF is:
FF 01 00 00 00 08 28 12 and the answer is FF 02 01 XX CRC16 XX-0;1;2;3
Using for 1st relay:
- name: RS484_Board255_Sw1
slave: 255
address: 0
write_type: coil
command_on: 255
command_off: 0
verify:
input_type: coils
address: 0
Now HA with “verify” is sending the command: FF 01 00 00 00 08 CRC16 - it is OK - it works!
But I did not know how to use “verify” for my 2nd relay.
Can you help me with it?