Sit and wait for something to happen... then continue


#1

1) Give a description of the problem
Not being able to pause/restart a piston… in the piston.

2) What is the expected behavior?
Use a WHILE loop to “hold” the piston mid-execution, then continue when a condition is met.

3) What is happening/not happening?
It holds, but when the virtual switch is turned off, it doesn’t continue after the WHILE ends… it completely exits the piston. I tried setting both the IF and WHILE to Never Cancel Tasks… but it didn’t help.

Surely there’s a way to get this working without using variables as a workaround?
I’m sure @ady624 could create a WaitUntill command that just sit’s there waiting for the condition to become true, then continue the piston. I’m not the only one who may benefit from this I’m sure. :wink:


#2

What about putting the PUSH after the IF?

11/16/2017, 4:56:00 PM +575ms
+129ms	║Switch is now off... do more stuff now ...
11/16/2017, 4:55:57 PM +310ms
+128ms	║Still waiting for switch to turn off...
11/16/2017, 4:55:48 PM +280ms
+111ms	║Still waiting for switch to turn off...
11/16/2017, 4:55:39 PM +384ms
+149ms	║Still waiting for switch to turn off...

#3

Why not just write the piston for virtual switch 1 changing to off?


#4

This is just a small example of a concept. Another use would be a light comes on in the morning. The system waits for the garage door to open (to warm up the car), then waits for the garage door to close since she’s leaving. When this occurs, the piston turns off a light it first turned on.

No… she has a crappy old Blackberry (ya she’s stubborn), so I can’t use it as “presence” when she leaves.


#5

That actually worked… for my small example, But what if …

  • Turn light on at 6am
  • WAIT for garage door to open (using a WHILE loop)
  • then Wait for garage to close (using a WHILE loop)
  • Turn off light

#6

Here’s what I’ve come up with.

  • Wait for virtual switch to start piston
  • Now wait for “GARAGE” switch to turn on (simulate open door)
  • Now wait for “GARAGE” switch to turn off (simulate closed door)
    … continue piston

I had to put something in the WHILE loop, or it won’t work. So I put a WAIT in it.


#7

shouldnt need a virtual switch or a while loop. see this:

i used an arbitrary limit of 1 hour but it could be anything.


#8

You misunderstood my virtual switch.
It was just to test the piston without actually opening and closing garage doors just to get my WHILE loops right.


#9

This is what the finished piston looks like. I still don’t like to have to use the WHILE loops, but at this time there’s nothing better.


#10

So lets see if I understand this correctly.

  • Piston will trigger at 6AM
  • Piston will actually wait until garage door is opened
  • followed within 1 hour by (never knew about this function)
  • Piston will wait for garage door to close
  • Light will be turned off

Is the “followed within 1 hour by” needed?


#11

correct. followed by needs a time range to be specified.

this avoids having to use a do-nothing while loop.


#12

The few times I tried to use “followed by” it defaulted to 1 minute and I couldn’t change it. Is the a settable parameter somewhere?


#13

yes it is. click on the condition after followed by.