I would like to reset a script delay on sensor event, is that possible somehow?
This is what I’m trying to do
I’m trying to handle lights so they stay on when someone is in a room. So when motion is triggered I start a “lamp off” script with a 2min delay. On repeated motion I would like to just reset the delay, not run the whole sequence.
timed_lamp:
alias: "Turn on lamp and set timer"
sequence:
# Cancel ev. old timers
- service: script.turn_off
data:
entity_id: script.timer_off
- service: switch.turn_on
data:
entity_id: switch.light1
# Set new timer
- service: script.turn_on
data:
entity_id: script.timer_off
timer_off:
alias: "Turn off lamp after 10 minutes"
sequence:
- delay:
minutes: 10
- service: switch.turn_off
data:
entity_id: switch.light
when a momement is detected first stop the countdown, turn on the light and activate countdown … this fires everytime a movement is detected by one motion sensor.
I think is what you need.
BTW: I took this from the community … Can’t remember where … credits to the original author
I am thinking he is having the same issue as me. All my scripted automatons fire every time it is reset. I am having an issue with some other automatons not running now since they keep getting reset. When I force my sensor to 1 using set state it will reset and fire all my scripts that are just verbal commands (which I do not want) and turn on the light then like its supposed to.
I am currently trying to figure out how to get it to reset the script without messing with the other scripts. I am putting the entity after the as well.
This is causing my Away/Home automations (turn all lights on/ off) to not fire.
Sorry if this is off topic since the title is about resetting script delays and I’m referencing an automation. I never got feedback on whether this worked or not so I’m not sure if it does because it calls brightness and RGB color while sending the turn off command but maybe you could try something like…