I’m trying to have a noisy air purifier that I keep in my office turn on and off automatically. The YAML below is what I’m using and it works to turn the air purifier off but not to come back on again. The issue seems to be the two minute delay. I want the air purifier to turn off immediately when it detects a presence, but not turn on unless presence is clear for 2 minutes. This is because occasionally it will detect presence is clear when I’m still sitting there, so the delay is to prevent those reactions to false reads. I have tried messing with the mode but that didn’t seem to help.
alias: Office Air
description: >-
Turn on the office air purifier if presence is detected and off if no presence
is detected.
triggers:
- trigger: state
entity_id:
- binary_sensor.office_presence_sensor_occupancy
- trigger: state
entity_id:
- binary_sensor.tv_couch_presence_occupancy
conditions: []
actions:
- if:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.tv_couch_presence_occupancy
state: "on"
- condition: state
entity_id: binary_sensor.office_presence_sensor_occupancy
state: "on"
then:
- type: turn_off
device_id: 9686c92b85e2a03e4b0352ca937bc313
entity_id: e8571243bf1b32e903aaf7ef8fcafaf8
domain: switch
- if:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.tv_couch_presence_occupancy
state: "off"
for:
hours: 0
minutes: 2
seconds: 0
- condition: state
entity_id: binary_sensor.office_presence_sensor_occupancy
state: "off"
for:
hours: 0
minutes: 2
seconds: 0
then:
- type: turn_on
device_id: 9686c92b85e2a03e4b0352ca937bc313
entity_id: e8571243bf1b32e903aaf7ef8fcafaf8
domain: switch
mode: queued
max: 10