Execute Piston Help


#1

1) Give a description of the problem
I’m calling a piston (P2) from within another piston (P1). The trouble I have is that after calling P2, it returns immediately to P1 even though it takes between 2.5 min and 13 min to finish. I have the setting for the Execute to Wait for Finish set to True but that is not working. It always returns immediately regardless of that setting. Is there something else I need to do to make that work as I intend? Are there commands in P2 that could be short-circuiting the process of waiting for the whole piston to be completed?

Also, is there a place that describes using Args when calling pistons from other pistons? I would like to pass a value to P2 from P1 and have P2 immediately use it.
Update: I figured out the $arg question.


#2

Anyone have any ideas about how to get this to work? My workaround is to loop waiting for the activity in P2 to complete, but I’m using a lot of Smartthings cycles to detect that state that could be saved if the piston did not return immediately.


#3

I agree with you… Creating dummy loops to wait is not ideal.

I might consider splitting up the two pistons into three.

P1 does stuff, and then the last command executes P2
P2 does stuff, and then the last command executes P3
P3 does more stuff

In this example, the last part of your current P1 could be moved into P3


Generally speaking, I usually keep my “Execute Piston” as the very last command in a piston.
(I always try to prevent two pistons from running at the same time)


Pro Tip:
This method is almost exactly like the GOTO command in basic programming, and can be quite useful here in webCoRE. (IE: If conditions are true, then Execute P3, else Execute P4)


#4

Yes, that should work. I was hoping that P1 would be like a scheduler that would call P2, then when its done, run the equivalent of P3. Now in thinking about it, I could still do the scheduler idea but with virtual switches, one for each routine, have each routine toggle its switch, and have the scheduler detect the change, reset the switch, and cause the next activity to happen. But in the spirit of KISS, I will daisy-chain the routines as you suggest.

Thanks for stimulating my brain cells.

Any idea why the Wait to Finish does not work?