공기청정기 자동화



condition구문에서 or, and 조건이 한눈에 보기 쉽게 바뀌었네요.

공청기 가동을 미세먼지 센서와 내,외부 창 열림/닫힘에 연동해 자동화를 수정해 봤습니다. 내부창과 외부 베란다창을 구분해 놓고 그룹으로 묶으니 공청기 가동시 예외사항을 많이 줄일 수 있네요.

대쉬보드에서 도어 아이콘등은 되도록 연한 색상을 사용해 on일 때 아이콘 색상이 두드러지게 보이도록 하고 따로 blink 아이콘 효과를 주는 것도 좋네요.


- id: 미세먼지-도어센서on
  alias: 미세먼지-도어센서on
  trigger:
  - platform: state
    entity_id:
      - group.out_door
      - group.in_door
    from: 'off'
    to: 'on'
  condition:
  - condition: state
    entity_id: group.air_purfier
    state: 'on'
  - and:
      - condition: state
        entity_id: group.in_door
        state: 'on'
      - condition: state
        entity_id: group.out_door
        state: 'on'
  action:
  - service: homeassistant.turn_off
    entity_id: group.air_purfier
  mode: single

 

- id: 미세먼지-20이상
  alias: 미세먼지-20이상
  trigger:
  - above: '20'
    entity_id: sensor.air_monitor_pm25
    platform: numeric_state
  - platform: state
    entity_id:
      - group.out_door
      - group.in_door
    from: 'on'
    to: 'off'
  condition:
  - above: '20'
    condition: numeric_state
    entity_id: sensor.air_monitor_pm25
  - or:
      - condition: state
        entity_id: group.in_door
        state: 'off'
      - condition: state
        entity_id: group.out_door
        state: 'off'
  action:
  - service: homeassistant.turn_on
    entity_id: group.air_purfier
  mode: single