Piston throttles Smartthings


#1

Hi,

I have a piston that changes the color of 4 bulbs until a variable is changed.
If the piston is running and I press the button, it takes ~5 seconds to stop its actions.
The button also triggers a switch and I can see the same delay there. It seems that somehow it throttles Smartthings.

I am not sure what I am doing wrong and also I don’t know about Smartthings limitations.
Any help would be much appreciated.

Here is the piston:

Thank you!


#2

The log would be diagnostic, but my guess is as follows …

The piston is in a loop using short waits (less than five seconds). Those will usually be implemented by the code looping, but every nine or ten seconds the piston will set a timer for the wait and exit instead. That just helps prevent it exceeding the execution time limit.

That means when you press the button to try and stop the loop the new piston instance will normally see the piston is already running and wait for it to finish for up to ten seconds (a semaphore wait) before it runs itself.

This might be one of the cases where you could usefully go into the piston settings and ‘enable parallelism’. That would let the second piston instance run immediately.


#3

I am not sure if this is the problem.
I pushed the button once, let the automation run for 40 seconds and tried to turn on a switch from Smartthings (while the automation was running). It took 17 seconds to turn it on. It seems that somehow Smartthings cannot handle these requests.

All the devices are executed locally (as shown on graph ui). I am not sure if this helps, since the automation is running in cloud.

The behaviour was similar for parallel and serial pistons.