New to webcore please critique my first piston


#1

1) Give a description of the problem
I want to turn on 2 lights, inside and outside when someone rings the doorbell and it is “dark” outside. I used 30 min before sunset for this.

2) What is the expected behavior?
As above. I also want the lights to turn off after a set time. For now I have it at 20 mins. I initially had the ‘wait’ command right after the ‘turn on’ command followed by ‘turn off’. This didn’t work so then I had a variable created. It seems like a long work around for something simple. Will the variable be false only after the piston runs?

3) What is happening/not happening?
The lights weren’t turning off. The lights did turn on with the doorbell push. So I changed the piston to what is posted now. As stated above. Wanted feedback. Thanks

**4) Post a Green Snapshot of the piston!

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)


#2

The following piston should do what you want… (no variables are necessary)

pic


#3

That was my first Piston and it never turned off! Thanks for the reply. Why not span midnight?


#4

The (N) on line 24 was likely not in your original post. That option forces the Turn off command to work, even though 21 minutes later, the button is no longer being pressed.

You can read up on Task Cancellation Policy here. (the “N” stands for Never)


Sometimes, it may work, but in many cases, it will not.

Take this simple example:
IF X is between 18 and 1, then do stuff

What do you think will happen if X is 12?


#5

Nice! what is the ‘N’ on line 24?

Thanks for the quick responses. I see the possible problem with midnight, or 00:00


#6

That is a setting for Task Cancellation Policy
I set it to “Never” so it will always resume after the WAIT.


#7

you can also check this link to see how it’s done.


#8

Thanks. The logic is interesting, like someone isn’t standing pressing the doorbell for 21 minutes so it didn’t turn off