My Code is misbehaving and I don't know why. - switch turn off delay with door opening

Hi Guys, I’m not how this is happening.

Here’s my code:

Basicly, it turns on switch (sonoff) in my doghouse when I open the patio door.
it’s supposed to auto turn off after X amount of time. (this works fine)

However, I found that if I open the door again, within that time frame, the lights turn off.
It’s like my code acks like a toggle when it’s not.

Here’s the history:

Move the action to a script and call the script in the automation instead. If the same automation is triggered during a delay in that automation it will skip the delay, but if you move it to a script it won’t.

1 Like