I have this automation setup and running fine but I want to add a 40min limit on light, if e.g door is left open, in that case light should turn off after 40mins . How should I add that?
description: "Turn on and off the bathroom light using the aqara contact sensor. "
triggers:
- entity_id:
- binary_sensor.door_sensor_2_opening_2
from: "off"
to: "on"
id: first opening
trigger: state
conditions: []
actions:
- metadata: {}
data: {}
action: light.turn_on
target:
entity_id: light.sonoff_zbminir2
- wait_for_trigger:
- entity_id:
- binary_sensor.door_sensor_2_opening_2
from: "off"
to: "on"
id: "wait for door to open again. "
trigger: state
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 5
- metadata: {}
data: {}
action: light.turn_off
target:
entity_id: light.sonoff_zbminir2
mode: single