Hi, I have a light with a fan connected in the powder room. I have a 10 min delay on the switch so if the room needs extra ventilation, you can leave the light switch on and then it will automatically turn off after 10min.
The problem is the delay timer keeps running if the switch is turned off. If someone goes in after say 9 minutes, the light will turn off after 1 min.
I am trying to get clear the delay that is running or reset the delay to 0 seconds if the switch is turned off ready for a new 10min delay when it is turned on again. I haven’t been able to do it.
Any help is appreciated.
output:
# status led
- platform: gpio
pin: GPIO4
id: relay0
inverted: true
# Top (or only) button
- platform: gpio
pin: GPIO13
id: relay1
light:
# status Led
- platform: binary
name: "${friendly_name} status_led"
output: relay0
id: status
# Top (or only) button
- platform: binary
name: "${friendly_name} light"
output: relay1
id: pwdr_light
on_turn_on:
- delay: 600s
- light.turn_off: pwdr_light
on_turn_off:
- delay: 0s # I want to reset the delay for the next time the light is turned on
# Buttons
binary_sensor:
# Top (or only) button
- platform: gpio
pin:
number: GPIO16
mode: INPUT
inverted: True
name: "${friendly_name} Button"
#toggle relay on push
on_press:
- light.toggle: pwdr_light