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.
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.
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?