Can anyone tell me why this piston runs so slowly?


1) Give a description of the problem
Piston works, but generally can take about 30 seconds plus to execute.

2) What is the expected behavior?
I want 3 outdoor osram light strips to mirror the colour of three indoor hue light strips. There will be times when I don’t want the behaviour mirrored hence not using smart lighting, other apps etc which are limited with regard to restrictions.

I’d like it to run faster. I had some ‘waited at a semaphore’ notices for 8-10secs, but then read a recommendation to turn on parallelism to aid with this, but I don’t think it has.

3) What is happening/not happening?
It’s too slow. Is this just cloud limitations? Or is it how I’ve built this piston?

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
Will post when back from work… Many thanks in advance for your help



Since each bulb only mirrors one bulb, I would be very tempted to split this into three triggers, each in it’s own piston.


IF RGB 13 stays unchanged for 1 sec
    Set RGB 18 to blah blah blah

Personally, I love variables, but I might be tempted to not use them in this case.
(since you aren’t storing them for later use)


IF RGB 13 stays unchanged for 1 sec
    Set RGB 18's hue to RGB 13's hue
    Set RGB 18's sat to RGB 13's sat

The entire piston can be those 3 lines. (plus any other conditions)

Pro Tip:
Since color adjustments can be subtle, and may take us a moment to get it ‘right’, there is a possibility for a piston like this to trigger many times back to back if you are adjusting the color manually. Ideally, an adjustment should be made no more frequently than once every 2 seconds. (or 1.5 seconds at the very least) Any more frequent than that may bring a semaphore delay for 10 seconds. (although it’s much less likely using 3 separate pistons)


Thanks @WCmore. Good tip and thanks. Will give this a go :slightly_smiling_face:


Take a look at async operation. Unless I’m misunderstanding the purpose/intent, I don’t think these actions need to run sequentially.


Thanks @jsducote I have tried asynchronous execution, but for some reason this stops it from working. Perhaps it’s to do with what’s been mentioned re. variables above…


Ok, so unfortunately it’s still painfully slow, but only when changing lights at the same time, i.e. if I change all three interior lights blue at the same time, it can take an age for the three outdoor lights to mimic this. However, when adjusting them individually it’s almost instant - here’s my revised piston based on above recommendations, can anyone see anything obvious here? Would it be better to make 3 separate pistons perhaps?

Ps. Can someone explain what parallelism does to me in laymans terms? I’ve enabled and disabled it but it doesn’t seem to make much difference - should I have it on?

Many thanks again.


Your IFs keep getting deeper and deeper nested, each one relying on the conditions of the previous. (IE: RGB Bulb 16 can’t do anything unless the previous 5 conditions (2 IFs and a Only When) happen first)

If you don’t want three pistons (my preference), I would at least make three totally separate IF blocks.

IF RGB 13 stays unchanged for 1 sec
    Set RGB 18's hue to RGB 13's hue
    Set RGB 18's sat to RGB 13's sat

IF RGB 14 stays unchanged for 1 sec
    Set RGB 17's hue to RGB 14's hue
    Set RGB 17's sat to RGB 14's sat

IF RGB 15 stays unchanged for 1 sec
    Set RGB 16's hue to RGB 15's hue
    Set RGB 16's sat to RGB 15's sat

Notice one IF totally ends before the next IF begins…

Also, maybe it is a personal preference, but I would totally do away with your ONLY WHEN and use IF instead (as shown above).

PS. I think Parallelism enabled will make this piston worse


Thanks again @WCmore can you clarify whether I should be using the ‘else’ section or ‘else if?’

When I’ve done this before I’ve generally used a series of ‘else ifs’ but I’m wondering whether this is correct? Or maybe it doesn’t matter?


WCmore has answered that.


Then maybe I’m misunderstanding… if I select ‘else’ it indents the ‘if’ statement which I believe what @WCmore was saying not to do. If I select ‘else if’ it doesn’t. But it displays ‘else if’ not ‘if’ as per @WCmore’s example above…


Generally speaking, I rarely use ELSE or ELSE IF.
(most of my IF blocks only use the THEN section)

In this case specifically, I would not use either of them.


Apologies but I think im properly confusing myself now :confused:

@WCmore would you be able to potentially green shot a piston for an example? Because I can only get the ‘if’ statement you example above by selecting ‘else’, however this automatically indents the ‘if’ statements that you mentioned I shouldn’t do.

I don’t seem to be able to get non-indented ‘ifs’ unless I select ‘else if’ statement for each bulb…

Again, I’m really sorry, but a piston shot would definitely help me understand this when you get a moment. :confused:


I am heading out the door right now, but you can use the very very last “Add a new statement” to create an IF at the bottom


Thanks, will give it a try!


Ok, not tested yet, but how does this look?


Not bad… Not bad at all… A couple things stands out to me that you may have to tweak during your testing though…

(1) Line 22, 39 & 55 are not the same. (they should all be triggers, not conditions)
(2) For some reason, your lightning bolts in the left margin do not look right. There should be one per IF block. Hopefully this will be resolved when you fix #1 above.


Thanks! Yeah, I noticed the trigger issue, but as soon as I pressed test they aligned as the should. Good spot on the differing conditions, I’ve now edited accordingly. Will test in a bit, but here’s the piston as it stands now, fingers crossed!:




Ok so, weird stuff now happening, piston no longer turns on lights, nor does it turn them off, but it does if I press ‘test’ just weird… giving up on it until tmrw, hoping it’s a cloud/Smartthings issue because I can’t see any reason this isn’t firing properly :frowning:

Edit hue hub is updating - so it could be that it’s not receiving the ‘hasn’t changed for 1sec’ part properly. Will try again tomorrow…


The triggers you choose are based on the hue changing… Meaning this piston is designed to synchronize the colors, and should not execute if the switch (or level) changes…