本帖最后由 jyz_0501 于 2018-10-29 18:50 编辑
- alias: auto_open_air_conditioner
initial_state: true
hide_entity: false
trigger:
- platform: numeric_state
entity_id: sensor.m1_a
value_template: '{{ states.sensor.m1_a.attributes.pm25 }}'
above: 75
- platform: numeric_state
entity_id: sensor.m1_a
value_template: '{{ states.sensor.m1_a.attributes.hcho }}'
above: 0.08
condition:
- condition: time
after: '6:00:00'
before: '22:00:00'
action:
- service: switch.turn_on
entity_id: switch.aircleaner
- service: tts.baidu_say
data_template:
entity_id: media_player.kodi
message: >
"室内空气质量较差,已为您自动开启空气净化器,维持十分钟!"
cache: false
- delay:
minutes: 10
- service: tts.baidu_say
data_template:
entity_id: media_player.kodi
message: >
"现在为您关闭空气净化器!"
cache: false
- service: switch.turn_off
entity_id: switch.aircleaner
|