|
本帖最后由 756641156 于 2021-4-6 10:21 编辑
https://www.xiaomiyoupin.com/detail?gid=139764&spmref=YouPinPC.$SearchFilter$1.search_list.1.75591963
请教大神云米互联网浴霸Node-red控制方法,目前只能通过MIoT云控制浴霸灯,通过xiaomi_miio_raw获取状态以及温湿度
#云米浴霸
sensor:
- platform: xiaomi_miio_raw
name: 云米浴霸
host: 192.168.*****
token: ************
default_properties:
- power
- humidity
- temp
- switch_state
- wind_tem
- off_time
- platform: template
sensors:
bhwindtem:
friendly_name: '设定温度'
value_template: "{{ state_attr('sensor.yunmi_bat_heater','wind_tem') }}"
unit_of_measurement: "°C"
bhofftime:
friendly_name: '延时关机时间'
value_template: "{{ state_attr('sensor.yunmi_bat_heater','off_time') }}"
bhhumidity:
friendly_name: '浴霸湿度'
value_template: "{{ state_attr('sensor.yunmi_bat_heater','humidity') }}"
unit_of_measurement: "%"
bhtemp:
friendly_name: '浴霸温度'
value_template: "{{ state_attr('sensor.yunmi_bat_heater','temp') }}"
unit_of_measurement: "°C"
bhstatusname:
friendly_name: '浴霸状态'
value_template: >
{% if state_attr('sensor.yunmi_bat_heater','switch_state') == 1 %}待机
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 4 %}换气
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 16 %}照明
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 16384 %}自然风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 4096 %}暖风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 256 %}自定义
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 20 %}照明&换气
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 16400 %}照明&自然风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 4112 %}照明&暖风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 272 %}照明&自定义
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 16388 %}换气&自然风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 4100 %}换气&暖风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 260 %}换气&自定义
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 16404 %}照明&换气&自然风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 4116 %}照明&换气&暖风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 276 %}照明&换气&自定义
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 68 %}延时&换气
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 80 %}延时&照明
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 16448 %}延时&自然风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 4160 %}延时&暖风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 320 %}延时&自定义
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 84 %}延时&照明&换气
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 16464 %}延时&照明&自然风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 4176 %}延时&照明&暖风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 336 %}延时&照明&自定义
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 16452 %}延时&换气&自然风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 4164 %}延时&换气&暖风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 324 %}延时&换气&自定义
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 16468 %}延时&照明&换气&自然风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 4180 %}延时&照明&换气&暖风
{% elif state_attr('sensor.yunmi_bat_heater','switch_state') == 340 %}延时&照明&换气&自定义
{% endif %}
switch:
- platform: template
switches:
bh_ventilate:
friendly_name: '换气'
value_template: "{{ state_attr('sensor.yunmi_bat_heater','switch_state')|int|bitwise_and(4) > 0 }}"
turn_on:
service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: ["{{ state_attr('sensor.yunmi_bat_heater','switch_state')|int + 4 }}"]
turn_off:
service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: >
[{% if state_attr('sensor.yunmi_bat_heater','switch_state')|int - 4 > 0 %} {{ state_attr('sensor.yunmi_bat_heater','switch_state')|int - 4 }} {% else %} 1 {% endif %}]
bh_lamp:
friendly_name: '浴霸灯'
value_template: "{{ state_attr('sensor.yunmi_bat_heater','switch_state')|int|bitwise_and(16) > 0 }}"
turn_on:
service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: ["{{ state_attr('sensor.yunmi_bat_heater','switch_state')|int + 16 }}"]
turn_off:
service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: >
[{% if state_attr('sensor.yunmi_bat_heater','switch_state')|int - 16 > 0 %} {{ state_attr('sensor.yunmi_bat_heater','switch_state')|int - 16 }} {% else %} 1 {% endif %}]
bh_customize:
friendly_name: '自定义'
value_template: "{{ state_attr('sensor.yunmi_bat_heater','switch_state')|int|bitwise_and(256) > 0 }}"
turn_on:
service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: ["{{ state_attr('sensor.yunmi_bat_heater','switch_state')|int + 256 }}"]
turn_off:
service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: >
[{% if state_attr('sensor.yunmi_bat_heater','switch_state')|int - 256 > 0 %} {{ state_attr('sensor.yunmi_bat_heater','switch_state')|int - 256 }} {% else %} 1 {% endif %}]
bh_heater:
friendly_name: '暖风'
value_template: "{{ state_attr('sensor.yunmi_bat_heater','switch_state')|int|bitwise_and(4096) > 0 }}"
turn_on:
service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: ["{{ state_attr('sensor.yunmi_bat_heater','switch_state')|int + 4096 }}"]
turn_off:
service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: >
[{% if state_attr('sensor.yunmi_bat_heater','switch_state')|int - 4096 > 0 %} {{ state_attr('sensor.yunmi_bat_heater','switch_state')|int - 4096 }} {% else %} 1 {% endif %}]
bh_blow:
friendly_name: '自然风'
value_template: "{{ state_attr('sensor.yunmi_bat_heater','switch_state')|int|bitwise_and(16384) > 0 }}"
turn_on:
service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: ["{{ state_attr('sensor.yunmi_bat_heater','switch_state')|int + 16384 }}"]
turn_off:
service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: >
[{% if state_attr('sensor.yunmi_bat_heater','switch_state')|int - 16384 > 0 %} {{ state_attr('sensor.yunmi_bat_heater','switch_state')|int - 16384 }} {% else %} 1 {% endif %}]
bh_idle:
friendly_name: '待机'
turn_on:
service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: [1]
turn_off:
service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.yunmi_bat_heater
method: set_switch
params: [1]
|
-
温湿度及状态
-
浴霸灯控制
|