Complete noob in need of some pointers

When I run the rule pictured below the light won’t turn on but if I remove the color picker and just have the ON command it works. Something is obviously not getting through my thick skull, but what?

Furthermore, I would like to have the light cycle through different colors when the same HTTP request is called. Something like this:

IF light = off THEN turn on and make it green
IF light = green THEN make it red
IF light = red THEN make it blue
IF light = blue THEN make it green

Would it even be possible? And if so, how?

Do I have to nest the IFs like this?

Or can i just stack them on top of eachother like this?

Would greatly appreciate it if some kind soul could help me understand a little bit better, I’m trying to get the hang of the syntax and all that but after reading forumposts for a couple of hours I can’t even tell a curly bracket from a square anymore.

Hi Pierre-
Am I understanding correctly that you toggled the ‘Advanced’ switch on and added the color argument to the on() command?

Keep in mind that the commands need to match what your hub is reporting or your hub will likely reject the command. For setting the color of a device, you would typically use the setColor() command… or setHue() and setSaturation() individually.

@Nezmo is doing something similar. They’re using the new Expressions feature along with an expression similar to:


Every time the expression runs, this randomly picks one of those numbers which are each ‘hue’ values. The next step in the rule could be a setHue($myRandomHue) command.

That’s going to depend on the logic. If each of the conditions can be impacted by each other, then having them sequentially won’t work.

For example, if you have something that says:

IF light is off
THEN turn on

IF light is on
THEN turn off

It’s going to run each of those conditions in sequence if they are stacked on top of each other, so the first condition will turn the light on, then the next condition will run and since the light is on, it will turn it off.

Depending on what your conditions are, sometimes they can be stacked though – it just depends on what the conditions are and how they interact with each other.

1 Like

Correct, I used the visual colorpicker in the rule engine. The hub uses values 0-100 for hue.

Got it working by doing this.

I was thinking the colorswitch could be done in the same action as the on command, maybe that’s possible?

How do I use this feature? Like this?

Allright, what about loops?
I was thinking if I set up the light to switch color with a delay of a coupe of seconds in between but don’t want to build a flow that is a mile long. Would it be possible to end the flow by calling the same http request that starts it or is that something that can make things fly off the handle?

Please see the comment above… you can’t arbitrarily adjust the commands. You must send commands that the device expects to receive, so you should be able to use the color picker with the setColor() command, for example. You can’t just add a color argument to the on() command since the device doesn’t expect that.

Each device might behave slightly differently with how they handle a setLevel() or setColor() command while they are turned off. Many devices will automatically turn on and set the level/color, but some may not. So you can try just sending the setColor() command for example and see if that works.

You can find documentation on the Expressions feature here:

If setup properly, there’s no issue with an action at the end of a flow triggering the rule to start over again. For example, some people have logic where the last step is to flip a variable false then true again to simulate a loop. Usually this is combined with delays and/or conditions to make sure you don’t get stuck in an infinite loop running super fast. This is not something we ‘officially’ recommend/support, but it seems to be a popular community approach.

Allright, just to clarify, it’s not possible to do something kind of like this? Provided that the commands in the fields for the strings below would follow syntax correctly of course, with variables perhaps?

Allright, wanted to make sure so that I don’t make your servers go haywire or something similar and turn your day into a shit one.

Thank you kindly for your assitance, you helped me get a better grasp of this whole thing and I’m quite pleased with how the flow turned out. :slight_smile: