script:
xjx_flush_on:
alias: 马桶冲水
sequence:
- service: xiaomi_miio_toilet.flush_on
data:
entity_id: binary_sensor.xjx_mt_seat
xjx_seat_on:
alias: 马桶圈加热开
sequence:
- service: xiaomi_miio_toilet.work_seatheat
data:
entity_id: binary_sensor.xjx_mt_seat
status: 1
xjx_seat_off:
alias: 马桶圈加热关
sequence:
- service: xiaomi_miio_toilet.work_seatheat
data:
entity_id: binary_sensor.xjx_mt_seat
status: 0
xjx_led_on:
alias: 马桶夜灯开
sequence:
- service: xiaomi_miio_toilet.work_night_led
data:
entity_id: binary_sensor.xjx_mt_seat
status: 1
xjx_led_off:
alias: 马桶夜灯关
sequence:
- service: xiaomi_miio_toilet.work_night_led
data:
entity_id: binary_sensor.xjx_mt_seat
status: 0
switch:
- platform: template
switches:
xjx_seat_switch:
unique_id: xjx_seat_switch
value_template: "{{ state_attr('binary_sensor.xjx_mt_seat','status_seatheat') }}"
availability_template: "{{ not is_state('binary_sensor.xjx_mt_seat', 'unavailable') }}"
turn_on:
service: script.xjx_seat_on
turn_off:
service: script.xjx_seat_off
xjx_led_switch:
unique_id: xjx_led_switch
value_template: "{{ state_attr('binary_sensor.xjx_mt_seat','status_led') }}"
availability_template: "{{ not is_state('binary_sensor.xjx_mt_seat', 'unavailable') }}"
turn_on:
service: script.xjx_led_on
turn_off:
service: script.xjx_led_off
|