如果机型只有简单的开机除湿和关机,或者使用独立的温湿度计来更准确的控制环境湿度,可以得用ha的自动化来控制大于设定湿度一定值时全力开机,低于设定湿度一定值时关机,以达到保持环境湿度在设置湿度附近。
alias: 除湿机自动工作
description: 除湿机自动工作
trigger:
- platform: time_pattern
minutes: /5
condition: []
action:
- choose:
- conditions:
- condition: template
value_template: >-
{{(states('sensor.zm1_b0f89324b2ac_humidity')|int -
states('input_number.deye_target')|int)>3 }}
sequence:
- service: humidifier.turn_on
data: {}
target:
entity_id: humidifier.chu_shi_ji
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- service: humidifier.set_humidity
data:
humidity: 25
target:
entity_id: humidifier.chu_shi_ji
- conditions:
- condition: template
value_template: >-
{{(states('input_number.deye_target')|int -
states('sensor.zm1_b0f89324b2ac_humidity')|int)>3 }}
sequence:
- service: humidifier.turn_off
data: {}
target:
entity_id: humidifier.chu_shi_ji
default: []
mode: single
sensor.zm1_b0f89324b2ac_humidity 为M1空气检测仪的湿度
input_number.deye_target 为设置目标湿度的辅助元素
每5分钟检查一次环境湿度与设定湿度的差值,决定是全力开机还是关机。
|