Getting second half of piston to only run when first half does


1) Give a description of the problem
I’m trying to write a piston that if the lights are off when a door is opened, it would turn them on to 100%, and stay on if the door is open, then turn off 2 min after the door is closed. (I currently have it set to 30 sec so I am not sitting around waiting for 2 min every time I test it. If any one of the lights are already on, I do not want the piston to run. I currently have the lights turn on and off how I want if all the lights are off, however, if a light is on, it turns that light off 2 min(30 sec) after the door is shut.

2) What is the expected behaviour?
If lights are already on, do not turn the lights off after the specified time.

3) What is happening/not happening?
When the lights are already on when the door is opened, they are turning off after the set time.

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full

+0ms ╔Received event [Tom And Amy Home].time = 1570244758365 with a delay of -1041ms
+442ms ║RunTime Analysis CS > 132ms > PS > 276ms > PE > 35ms > CE
+445ms ║Runtime (39628 bytes) successfully initialized in 276ms (v0.3.10f.20190822) (444ms)
+446ms ║╔Execution stage started
+454ms ║║Cancelling condition #2’s schedules…
+461ms ║║Cancelling condition #11’s schedules…
+462ms ║║Condition #11 evaluated true (1ms)
+463ms ║║Cancelling condition #8’s schedules…
+465ms ║║Condition group #8 evaluated true (state changed) (5ms)
+467ms ║║Cancelling statement #12’s schedules…
+483ms ║║Executed physical command [Basement Love seat Lamp].off() (12ms)
+484ms ║║Executed [Basement Love seat Lamp].off (14ms)
+497ms ║║Executed physical command [Office Lamp].off() (11ms)
+498ms ║║Executed [Office Lamp].off (13ms)
+500ms ║╚Execution stage complete. (54ms)
+502ms ╚Event processed successfully (501ms)


I’m not at a computer to play with pistons but what you can do is use a variable to keep track of the lights being turned on programmatically.

Create a boolean variable programmatic.

In your first statement add a set variable programmatic = true after the Turn On task.

In your second statement, add a condition to check if programmatic variable == true

After your Turn Off task, add the set variable programmatic = false


Thanks for your help!

I got the boolean variable created, I have it set to check it at the beginning of the second statement, however, I am having a hard time finding where to go to set the variable programmatic.


Did you get this sorted out?