cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop currently running action or add condition to specific action step?

Dmitrijs
Community Member

Hi, I have simple (as I though) task.

When door is opened, wait for 5 seconds and switch on the light

When door is closed switch off the light.

Problem is, if I close the door within this 5 seconds light is switched on behind the closed door when time comes.

I couldn't find the way to add condition on second part of the action (switching the light on only if door still opened) after time.delay or maybe cancel the action that is already running.

 

Are there any workarounds or am I missing something simple?

1 Recommended Answer

You might have to look into Google scripts (public preview) to add sensor conditions like... If the door sensor is open for longer than 5 seconds turn on light (if that's even possible there).

Also check the sensor manufacturer's app to see if there's anything like that.

Without special script coding of an automation I can only think to mitigate or reduce the lighting like ...

1. Door opens: delay 5 seconds, light on.

Door closes: delay (up to) 5 seconds, light off.

OR

2. Use a light strip at 1% which has a much lower brightness than a bulb at 1% and then 50% to 100% after 5 seconds.

View Recommended Answer in original post

5 REPLIES 5

So let me see if I understand you correctly.

Door open Light on for 5 seconds 

Door closed light off.

But if door closes with the 5 second delay you want the light to turn off immediately?

Well, I would try...

1st automation: open = on

2nd automation: light on triggers 5 second delay

3rd automation: closed = off

Hopefully the 3rd automation will override the delay.

 

 

 

Dmitrijs
Community Member

Hi, not exactly

Door open 

 - delay 5 seconds ( in case I just opened it to throw socks in the laundry basket, I do not need the light)

 - after 5 seconds lights on (in case I actually need something in the closet)

Door closed 

 - lights off

 

But what happens when Door closed after let's say 3 seconds, lights still switched on after following 2 . Exactly 5 seconds after opening even though door is already closed.

You might have to look into Google scripts (public preview) to add sensor conditions like... If the door sensor is open for longer than 5 seconds turn on light (if that's even possible there).

Also check the sensor manufacturer's app to see if there's anything like that.

Without special script coding of an automation I can only think to mitigate or reduce the lighting like ...

1. Door opens: delay 5 seconds, light on.

Door closes: delay (up to) 5 seconds, light off.

OR

2. Use a light strip at 1% which has a much lower brightness than a bulb at 1% and then 50% to 100% after 5 seconds.

I see, script does have it's limitations.

This answer actually is a good workaround. I set five switch off actions with 1 second interval after door is closed. This is closest to what I'm trying to achieve.

Thank you

You're welcome 👍