Momentary buttons to set light colors

light
buttons

#1

1) Give a description of the problem
Piston works fine, but I’m trying to find a more efficient way to do the code. Rather than a bunch of if/else/elseif, maybe there’s a way to “case” the current virtual momentary button and set a color based off the button that was pressed?

I’ll be adding additional buttons for creating other lighting schemes and I want to keep the code to a minimum.
Really just trying to make this more elegant and efficient, and help/thoughts would be appreciated.

4) Post a Green Snapshot of the pistonimage


#2

You answered your own question. A switch/case statement would most definitely be the best/efficient way to do this. It will make adding more a breeze. Instead of several simulated switches just use a simulated minimote.

If you don’t know how to set up up then click here

Select options and enable advanced statements. Then add a new statement, then select condition and you will see switch/case. Switch will be the simulated minimote button push and the the cases will be the different button pushes.


#3

okay, so I understand creating a simulated minimote in the ST IDE, but my problem is I want to make this work with ActionTiles, and I don’t believe a sim. minimote will work.
Momentary button tiles do work with ActionTiles.

The end result is a simple ActionTiles panel which gives me different buttons to press to change all the lights to a specific color (based on each button).

Also, I’m not super good on coding, but I can try and fumble through the switch/case statement, but may need some help.

Thanks!
-rak


#4

The problem with using different simulated anything is that the switch/case is best for looking at a single devices multiple inputs. Otherwise you might just have to use if/then statements. No need for endless else ifs. You can create as many if/thens as you want.


#5

Thanks for the quick response… I went ahead and did 4 separate IF statements, and it works just fine.

Posting a pic of the piston…
-rak