Turn lights off with wait?


#1

Is the wait command proper for turning lights off? Say a door opens, want to turn on the lights, then wait a few minutes and shut the lights off.

This does not seem to be working correctly and my lights are staying on.


#2

Two issues that I see. First, change “contact is open” to “contact changes to open.” The former is a condition, the latter a trigger. When you have two conditions (‘is open’ and ‘time’) and no triggers in your ‘if’, webCore subscribes to both conditions and treats them as triggers. When you make this change, you’ll note the lightning bolt will appear only next to your first line.

Secondly, click on your ‘with’ and then the cog next to the blue Save button, and change task cancellation policy to Never. This will prevent a condition change (the door closing) from cancelling your wait.

Here’s my revision:

Image1


#3

Excellent tip. I will modify my code accordingly. Thanks.


#4

Wouldnt you want the light to turn off after the contact closes rather than after a period of time? I would use contact stays closed for x seconds to turn off the lights. That way, if the door is open longer you’re not left in the dark. If you never cancel, if someone comes behind the first, the light may not stay on for them.