Lighting Routine- Exit And Hue


1) Give a description of the problem

I am having two problems with some RGB light routines I want to make.

1.The first is with exits. Maybe I am understanding this wrong, but I created an Async trigger at the bottom if my script. Basically, if the piston is running, and I turn the lights off, I want the Piston to stop. Instead, when I turn them off, the lights turn right back on and the Piston continues. I also want to better understand the value in the exit. I know I could disable automatic, but I do not need a value in this case. However, Webcore requires one be there to allow me to exit? I get the error that piston could not set state. Any advice would be appreciated.

  1. My RGB bulbs seem to not like the set hue command. When I put a hue in, the hue that sets is different than what I put in. However, fading the hue produces the correct result. It also seems that hue fades under a certain number of seconds don’t produce the results. It has to be about 10 seconds to end up fading to what I want it to be. I would really just prefer it set Anyone have any ideas?

2) What is the expected behaviour?
(I would like the piston to exit. I would like hue to set rather than fade.)

3) What is happening/not happening?
Piston does not exit. Hue comes out wrong when set hue command is used. )

**4) Post a Green Snapshot of the piston!


A few observations, if I may…

An ASYNC IF without a WAIT is no different that a normal IF.
(pistons still execute top to bottom)

Any trigger in a piston will always execute the piston at each event…
(and process the entire code, from top to bottom)

Maybe try that block at the very top?

I get the best results using the command:
Set color … (hsl)



Thank you always for your quick replies!

Just so I understand. If I place that block at the top as a normal sync block, and the piston was half way through its script, then in theory it seeing the switch turn to off would start it back at the top?

I tried the HSL command but didn’t have luck. Maybe I should play around with it on a different device to see if the device handlers are wonky. I did have some trouble getting them added into ST yesterday.


Yes, regardless where in the piston the trigger is at, each execution starts at the top.

Quick example:



I get in the habit of testing all commands with new devices, to determine which works best with that particular device.


An Update.

I did move the exit statement to the top, but that alone did not seem to do it. What did seem to work was changing the statement for the exit from “changes to off” to “changes away from on”. Maybe it sees that faster than it sees the switch off. Now that appears to be working… for now… I will report back on the color stuff once I play around.


… Interesting… I would imagine there may be a 10ms difference between the two “events”.
(but I’m honestly surprised it makes a difference)


As well as I! I seem to recall that my original logic worked for a while on these RGB bulbs. It was only after I bought a couple more and began programming them I saw the issue. I have similar exit statements in other lighting pistons. Those exist if a fade was occurring while I left home, the location mode change would cause an exit. I am now curious if those exits still work as written.