本帖最后由 121665460 于 2021-2-2 08:47 编辑
效果:
核心代码(利用新的自动化功能):
action:
- choose:
- conditions:
- condition: state
entity_id: sensor.bhstatus
state: '16'
sequence:
- service: sensor.xiaomi_miio_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: [20]
- service: input_boolean.turn_off
entity_id:
- input_boolean.bh_daiji
- input_boolean.bh_fengnuan
- input_boolean.bh_ziranfeng
- input_boolean.bh_zidinyi
- conditions:
- condition: state
entity_id: sensor.bhstatus
state: '4096'
sequence:
- service: sensor.xiaomi_miio_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: [4100]
- service: input_boolean.turn_off
entity_id:
- input_boolean.bh_daiji
- input_boolean.bh_zhaoming
- input_boolean.bh_ziranfeng
- input_boolean.bh_zidinyi
- conditions:
- condition: state
entity_id: sensor.bhstatus
state: '4112'
sequence:
- service: sensor.xiaomi_miio_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: [4116]
- service: input_boolean.turn_off
entity_id:
- input_boolean.bh_daiji
- input_boolean.bh_ziranfeng
- input_boolean.bh_zidinyi
default:
- service: sensor.xiaomi_miio_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: [4]
- service: input_boolean.turn_off
entity_id:
- input_boolean.bh_daiji
- input_boolean.bh_zhaoming
- input_boolean.bh_fengnuan
- input_boolean.bh_ziranfeng
- input_boolean.bh_zidinyi
完整配置文件:
原先的不好,请参考https://bbs.hassbian.com/forum.p ... 45&page=1#pid360292这里写input_boolean可以不用 |