Hello!
I had a problem with using one RS-485 channel, in this case I use USB SERIAL RS-485 to communicate with my devices. There are different devices on the network with different configurations (the stop bit is currently different). So, we made 2 modbus rtu on the port / dev / ttyUSB0.
I post the configuration below (part of configurations):
modbus:
- name: hub1
type: serial
timeout: 1
method: rtu
port: /dev/ttyUSB0
baudrate: 9600
stopbits: 1
bytesize: 8
parity: N
- name: hub_wb
type: serial
timeout: 1
method: rtu
port: /dev/ttyUSB0
baudrate: 9600
stopbits: 2
bytesize: 8
parity: N
sensor:
- platform: modbus
scan_interval: 60
registers:
- name: power_active
hub: hub1
unit_of_measurement: W
slave: 1
register: 12
register_type: input
count: 2
data_type: float
precision: 2
- name: current
hub: hub1
unit_of_measurement: A
slave: 1
register: 6
register_type: input
count: 2
data_type: float
precision: 2
- name: power_apparent
switch:
- platform: modbus
scan_interval: 10
coils:
- name: Hall
hub: hub_wb
slave: 127
coil: 5
- name: Hall (lights)
hub: hub_wb
slave: 127
coil: 4
- name: Kitchen
hub: hub_wb
slave: 95
coil: 1
- name: Kitchen2
hub: hub_wb
slave: 95
coil: 0
- name: Bedroom
hub: hub_wb
slave: 95
coil: 5
Error Logs:
2020-03-26 10:06:40 ERROR (SyncWorker_9) [homeassistant.components.modbus.sensor] No response from hub hub1, slave 1, address 12
2020-03-26 10:06:40 ERROR (SyncWorker_3) [homeassistant.components.modbus.switch] No response from hub hub_wb, slave 95, coil 0
2020-03-26 10:06:42 ERROR (SyncWorker_5) [homeassistant.components.modbus.switch] No response from hub hub_wb, slave 127, coil 4
2020-03-26 10:06:42 ERROR (SyncWorker_11) [homeassistant.components.modbus.sensor] No response from hub hub1, slave 1, address 12
2020-03-26 10:06:43 ERROR (SyncWorker_1) [homeassistant.components.modbus.switch] No response from hub hub_wb, slave 95, coil 2
2020-03-26 10:06:43 ERROR (SyncWorker_6) [homeassistant.components.modbus.sensor] No response from hub hub1, slave 1, address 30
2020-03-26 10:06:43 WARNING (SyncWorker_15) [pymodbus.client.sync] Cleanup recv buffer before send: 0x7f 0x1 0x1 0x0 0x49 0xa0
2020-03-26 10:06:43 ERROR (SyncWorker_18) [homeassistant.components.modbus.switch] No response from hub hub_wb, slave 127, coil 4
2020-03-26 10:06:43 ERROR (SyncWorker_19) [homeassistant.components.modbus.switch] No response from hub hub_wb, slave 95, coil 1
2020-03-26 10:06:43 ERROR (SyncWorker_15) [homeassistant.components.modbus.sensor] No response from hub hub1, slave 1, address 18
2020-03-26 10:06:43 ERROR (SyncWorker_17) [homeassistant.components.modbus.switch] No response from hub hub_wb, slave 127, coil 5
2020-03-26 10:06:43 ERROR (SyncWorker_14) [homeassistant.components.modbus.sensor] No response from hub hub1, slave 1, address 342
2020-03-26 10:06:43 ERROR (SyncWorker_7) [homeassistant.components.modbus.switch] No response from hub hub_wb, slave 127, coil 0
2020-03-26 10:06:44 ERROR (SyncWorker_11) [homeassistant.components.modbus.switch] No response from hub hub_wb, slave 95, coil 5
2020-03-26 10:06:44 ERROR (SyncWorker_5) [homeassistant.components.modbus.sensor] No response from hub hub1, slave 1, address 6
But, during operation, very often there are errors during the day, and as I understand it, the worker calls both modbus in parallel (unfortunately there is currently no oscilloscope to check) and causes errors in the channel, and therefore it is not possible to get the correct data. How can you decide? For example, it’s somehow related what works on one port and parallel requests cannot be.
Here is the physical connection: