Hello. I’m asking for help.
I’m trying to set up Modbus operation: raspberry pi via the RS485 CAN HAT card (https://www.waveshare.com/wiki/RS485_CAN_HAT ) must communicate with the Modbus RTU Relay 16CH relay board (https://www.waveshare.com/wiki/Modbus_RTU_Relay_16CH). The python file is working, the relays turn on and off. And the Home Assistant Supervisor (ver 1.7.0) does not want to work with modbus at all. Everywhere there are examples only for USB-RS485 converters.
I trying to get data on the current status of each relay. Here is a sample code in the Home Assistant:
modbus:
- name: hub1
type: serial
port: /dev/ttyS0
baudrate: 9600
bytesize: 8
method: rtu
parity: N
stopbits: 1
binary_sensors:
- name: rele0_state
address: 0
device_class: plug
input_type: coil
slave: 1
slave_count: 15
unique_id: rele_WSH_sens_0
The code is sent:01 01 00 00 00 10 3D C6 and the correct relay status code 0x1 0x1 0x2 0x0 0x0 0xb9 0xfc is received, but only once. Then the responses no longer come and the relay status displayed as “unavailable”.
I tried to change the N/E/O, 2/1, speed.
I’ve tried adding and changing:
delay: 0
message_wait_milliseconds: 30
timeout: 15
Stopbits 1 or 2 has no effect.
A-A and B-B and Gnd are connected correctly.
I tried to connect a 120 Ohm resistor on the board, at the beginning and at the end of the line, I tried a 100 Ohm resistor. Nothing helps.
I always get two correct answers and then the mistakes start.
Why doesn’t the correct answer come the third time? Why are there such problems with modbus?
I am attaching photo of logs of modbus in Home Assistant operation.