I have a Athon presence sensor that has PIR nad mmmWave. The way I was trying to create my automation is when the PIR detects then turn on bathroom lights
if the mmWave detects motion within 5 min. Turn on the Fan. for 10 min. If the motion is still detected within the that 10min interval, reset timer and continue running the fan. Once mmWave detection does not detect anything turn off lights and let the fan complete the 10 min time interval.
Can someone take a look at my yaml file and tell me if I am using the “Choose” Condition correctly. I have 3 currently and the 1st and 3rd execute but the 2nd does not and that is where I have the logic to check the detection timer for 3min via the mmmWave detection to start the bathroom fan.
my yaml code.
alias: A TEST MasterBathroom mmWave
description: Master Bathroom Athom PIR Detected
trigger:
- platform: state
entity_id:
- binary_sensor.athom_master_bathroom_athompir_pir_sensor
to: "on"
id: MasterBathroomAthomPir-Detection
from: null
- platform: state
entity_id:
- binary_sensor.athom_master_bathroom_athompir_mmwave_sensor
to: "on"
id: MasterBathroomAthomMMWave-Detection
from: null
- platform: state
entity_id:
- binary_sensor.athom_master_bathroom_athompir_mmwave_sensor
to: "off"
id: MasterBathroomAthomMMWave-Clear
from: null
- platform: event
event_type: timer.finish
event_data:
entity_id: timer.bathroom_fan_timer
id: TimerFinished
- platform: event
event_type: timer.reset
event_data:
entity_id: timer.bathroom_fan_timer
id: TimerReset
- platform: event
event_type: timer.finish
event_data:
entity_id: timer.delaybeforetimercall
id: DelayTimerFinishedForToiletOrShower
condition: []
action:
- choose:
- conditions:
- condition: and
conditions:
- condition: trigger
id:
- MasterBathroomAthomPir-Detection
- condition: state
entity_id: switch.masterbathroomvanity_655
state: "off"
- condition: numeric_state
entity_id: sensor.athom_master_bathroom_athompir_light_sensor
below: 3
enabled: true
sequence:
- service: switch.turn_on
target:
entity_id: switch.masterbathroomvanity_655
data: {}
- service: timer.start
metadata: {}
data:
duration: "00:00:20"
target:
entity_id: timer.delaybeforetimercall
- choose:
- conditions:
- condition: and
conditions:
- condition: trigger
id:
- MasterBathroomAthomMMWave-Detection
- condition: trigger
id:
- DelayTimerFinishedForToiletOrShower
sequence:
- service: switch.turn_on
metadata: {}
data: {}
target:
entity_id: switch.masterbathroomfan_654
- service: timer.start
metadata: {}
data:
duration: "00:15:00"
target:
entity_id: timer.bathroom_fan_timer
- choose:
- conditions:
- condition: trigger
id:
- MasterBathroomAthomMMWave-Clear
sequence:
- service: switch.turn_off
metadata: {}
data: {}
target:
entity_id: switch.masterbathroomvanity_655
mode: single