- 积分
- 298
- 金钱
- 257
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
中级会员
- 积分
- 298
- 金钱
- 257
- HASS币
- 0
|
发表于 2022-12-10 18:01:28
|
显示全部楼层
本帖最后由 msavi 于 2022-12-10 18:05 编辑
我也遇到现样的问题,家里有8个mudbus温控器,都设置成不同的地址码,接入1个没问题,接入2个只能显示一个,你的问题解决了吗?我的代码如下:
## 配置mod_bus
# 配置mod_bus设置
uart:
- id: mod_bus
baud_rate: 9600 # speed to STC15L101EW
stop_bits: 1
tx_pin: GPIO1
rx_pin: GPIO3
# 配置mod_bus日志文件
debug:
direction: BOTH
dummy_receiver: false
after:
delimiter: "\n"
sequence:
- lambda: UARTDebug::log_string(direction, bytes); ## UARTDebug::log_hex(direction, bytes, char separator) 将字节记录为字符串值
modbus:
- id: mod_bus_1
send_wait_time: 200ms
- id: mod_bus_2
send_wait_time: 200ms
- id: mod_bus_3
send_wait_time: 200ms
- id: mod_bus_4
send_wait_time: 200ms
- id: mod_bus_5
send_wait_time: 200ms
- id: mod_bus_6
send_wait_time: 200ms
- id: mod_bus_7
send_wait_time: 200ms
- id: mod_bus_8
send_wait_time: 200ms
- id: mod_bus_10
send_wait_time: 200ms
modbus_controller:
- id: elex_1 #客厅空调温控器
address: 0x1
modbus_id: mod_bus_1
setup_priority: -10
update_interval: 2s
- id: elex_2 #餐厅空调温控器
address: 0x2
modbus_id: mod_bus_2
setup_priority: -10
update_interval: 2s
- id: elex_3 #主卧空调温控器
address: 0x3
modbus_id: mod_bus_3
setup_priority: -10
update_interval: 2s
- id: elex_4 #次卧空调温控器
address: 0x4
modbus_id: mod_bus_4
setup_priority: -10
update_interval: 2s
- id: elex_5 #客卧空调温控器
address: 0x5
modbus_id: mod_bus_5
setup_priority: -10
update_interval: 2s
- id: elex_6 #书房空调温控器
address: 0x6
modbus_id: mod_bus_6
setup_priority: -10
update_interval: 2s
- id: elex_7 #地暖控制器
address: 0x7
modbus_id: mod_bus_7
setup_priority: -10
update_interval: 2s
- id: elex_8 #新风控制器
address: 0x8
modbus_id: mod_bus_8
setup_priority: -10
update_interval: 2s
- id: elex #机柜测试温控器
address: 0xA
modbus_id: mod_bus_10
setup_priority: -10
update_interval: 2s
switch:
## 设置温控器开关
- platform: modbus_controller
modbus_controller_id: elex_1
id: kt_air
name: "客厅空调开关"
register_type: holding
address: 0x1
bitmask: 1
- platform: modbus_controller
modbus_controller_id: elex_2
id: ct_air
name: "餐厅空调开关"
register_type: holding
address: 0x1
bitmask: 1
#读取温控器设置
sensor:
- platform: modbus_controller
modbus_controller_id: elex_1
id: kt_tem
name: "客厅温度"
address: 0x06
unit_of_measurement: "°C"
register_type: holding
value_type: S_WORD
accuracy_decimals: 1
skip_updates: 1
# filters:
# - multiply: 0.01
|
|