confiurg里面加一个input_number
humdioffset:
initial: 0
min: -5
max: 16
step: 1
自动化脚本如下:
其实就是当前湿度线性反对应加湿器风扇等级
这样子把净化器调到"最爱"之后就是跟着湿度调整风量,调到“自动”后就是跟着PM2.5调整风量。
然后根据需要调节一下humdioffset,感觉加湿满就调高一点
- alias: auto humdi control every 5 min
initial_state: true
hide_entity: false
trigger:
- platform: time_pattern
minutes: "/5"
action:
- service: fan.xiaomi_miio_set_favorite_level
data_template:
entity_id: fan.xiaomi_air_purifier_woshi
level: >
{% set state = ( 22.0 - (states.fan.xiaomi_air_purifier_woshi.attributes.humidity | float) / 2.5 + states.input_number.humdioffset.state |int ) |int -%}
{%- if state > 16 -%}
{%- set state = 16 -%}
{%- elif state < 0 -%}
{%- set state = 0 -%}
{%- endif %}
{{ state }}
|