Hello all,
First post here. I am migrating from Hubitat and I am trying to figure out an automation that I had in HE. I know I can do it with 2 automations, but would really like to confine it to one if possible.
Scenario is that I have a Z-Wave contact sensor on my closet door and a Z-Wave light switch. When I open the door, I want the closed light to turn on and when I shut the door, I want the closet light to turn off. I have figured that automation out and it works perfectly. But here is what is throwing a monkey wrench into the equation. My wife usually leaves the door ajar, so I would like to turn the light off after 30 minutes regardless of door state.
Door Open - Light On
Door Closed - Light Off
Door Open > 30 minutes - Light Off
Here is the automation I have so far:
alias: 'Lighting: Master Closet'
description: ''
trigger:
- platform: state
entity_id: binary_sensor.door_master_closet
from: 'off'
to: 'on'
id: door_open
- platform: state
entity_id: binary_sensor.door_master_closet
id: door_closed
from: 'on'
to: 'off'
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: door_open
sequence:
- service: light.turn_on
data: {}
target:
entity_id: light.master_closet_light
- conditions:
- condition: trigger
id: door_closed
sequence:
- service: light.turn_off
data: {}
target:
entity_id: light.master_closet_light
default: []
mode: single
I have tried to add a delay and turn off sequence in the door_open choose, but the light does not go off after closing the door. I have also tried to add a delay and light off command in the default actions but that did not work either.
Any ideas? Am I close or is this not doable?
Thanks,
Scott