Help with programming

Could someone show a proper working screenshot of a program of a color loop that switches on and off by a button press please?
Thank You

You may want to look at options in Rule Machine and other built-in apps or Community apps, not just writing code

I think they are probably looking for an example of how to "program" an existing app, such as rule machine. Like how to build the rules.

@zsolt.toth.39 The button press I understand, but can you explain what you mean by a color loop? Are you wanting a color bulb to keep changing colors constantly? Or changes colors each time you press the button? Or... something else?


It seems like this is something you have asked before, and the first of these contains one option that might do what you're asking for. If that's not what you want, it may help to specify exactly what you do want, as @jtp10181 suggests.

It may also be better to just reply to your existing post after waiting a while (which you have), asking again or providing more clarification. Too late now and it would probably make things more confusing unless staff merge the threads--but something to consider for next time. :slight_smile:

1 Like

yepp and still didnt get proper reply . and still ....

In fairness, you haven't clarified the original question as requested by @jtp10181


color loop is for eg color light sources (rgb, cct . etc) randomly changing colours. Bit of an extra might be able to select the selection of colors and times.
Thank you

just got home from work . cheers

1 Like

The biggest unanswered question that I see is how you want to start and stop the "loop."


Button press preferably but could be virtual switch whatever

That's one question. The other is, which of these two is desired:


1 Like

Start and stop with the same button or different buttons? How do you want to move through the colors? Time (automatically)? With buttons only (manually)? Both?

Also: predefined colors in a specifies order? Random colors? Anything else you can think of?

1 Like

not the triggering the issue for me but the random color Repeats(loops)
I would appreciat a detailed description or screenshot because im too lame for programming

random . not necesarry to specify colors, but would be good

So this is where I get stuck.

What do you mean by random color repeats? Because I interpret a repeat to be a repetition of a prior pattern. And therefore a removal of any randomness.


Hubitat can do almost anything, but you have to know what to tell it to do. To do that, you have to know what you want to do. Unfortunately, I still do not see a answer to this question, so a rule/app cannot be written:


It's great that you know how to "trigger" what you want, but it would be good to for the rest of us to know what that is, too, because depending on what you want, your actions may need to be written differently. It's also still not clear if you want truly random colors or just a set that you've defined somewhere, in a random order or in a specific/looped order.

I would suggest being as clear and specific as possible.

1 Like

Here is a Rule Machine example I just made and tested. The button will toggle the rule on / off, turning the light off when the rule turns off.

When you turn it on, every 5 seconds a random color is set on the light. It will run until it is stopped by pushing the same button again.


I also tried doing a capture and restore to set the light back how it was, but I think because the rule runs a second time when you turn it off it cancels out the capture from the first run. You would need a capture device to save it, which adds more complexity (that you did not ask for).

1 Like

Here is another example using a virtual switch. You could toggle the virtual switch with the button controller app easily. This is a more simple rule but the light would not turn off immediately when the switch goes off, it would turn off at the next 5 second repeat loop (so max of 5 seconds delay). This one it is also easier to add the capture and restore because it would not trigger a second time.

I think it could be modified with a wait for event so that it would turn off right away when the switch goes off.

1 Like

Much appreciated for the help guys. Thank you JTP. You cant imagine how many times i asked for it.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.