I’m trying to automate my ceiling fan based on a counter. If the counter is below 5 and no Presence is detected then wait 5 minutes and turn off , if over 5 then wait 20 minutes however this doesn’t seem to be happening. I can see the counter is working correctly so it must be my logic
alias: Ensuite Ceiling Fan
description: ""
triggers:
- trigger: state
entity_id:
- binary_sensor.shower_2_presence
to: "on"
id: Presence Home
- trigger: state
entity_id:
- binary_sensor.shower_2_presence
to: "off"
id: Presence Away
for:
hours: 0
minutes: 5
seconds: 0
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- Presence Home
sequence:
- type: turn_on
device_id: cee4b35b0939f91ce077ca05a906a5f6
entity_id: 582dedd642599d97da8e8b0dfaac907f
domain: switch
- conditions:
- condition: trigger
id:
- Presence Away
- condition: numeric_state
entity_id: counter.ensuite_shower_counter
attribute: "0"
below: 5
sequence:
- delay:
hours: 0
minutes: 5
seconds: 0
- type: turn_off
device_id: cee4b35b0939f91ce077ca05a906a5f6
entity_id: 582dedd642599d97da8e8b0dfaac907f
domain: switch
- conditions:
- condition: trigger
id:
- Presence Away
- condition: numeric_state
entity_id: counter.ensuite_shower_counter
attribute: "5"
above: 5
below: 100
sequence:
- delay:
hours: 0
minutes: 20
seconds: 0
- type: turn_off
device_id: cee4b35b0939f91ce077ca05a906a5f6
entity_id: 582dedd642599d97da8e8b0dfaac907f
domain: switch
mode: single