I have a RGBW light strip as below and have managed to figure out how to use the physical button to turn the strip on/off.
My next challenge is trying to figure out how to get a double click of the physical button to cycle through 5 or 6 predefined colours/brighnesses.
I’ve seen one or two old topics but they relate to neopixel stuff so hence I thought maybe a fresh topic was called for Any help would be much appreciated.
This is not the solution but just a record of my progress…
In my testing I had issues differentiating between a press and a double click, so for now I have been testing out a short press and longer press like this…
It works well and the long press sets the colour to bright red…
Next task is to figure out how to make it cycle through various presets on each long press.
Awesome thanks! I had a crack and it uploads okay but the log shows me that when I medium press to change colour it actually qualifies all the If condition and sets the colour to the last one GREEN.
Any thoughts or maybe even some tips on how to log the click_counter so I can see if it’s being increased?
Unfortunately i’m facing the same problem here.
If I use input boolean with true/false that does work but that limits you to 2 options only.
Might need someone else to have a look on this.
Here’s the code that I was using as reference
# double click to change
- timing:
- ON for at most 1s
- OFF for at most 1s
- ON for at most 1s
- OFF for at least 0.2s
then:
- lambda: |-
auto call = id(internal_light).turn_on();
if (id(counter) == 0) {
call.set_cold_white(1);
call.set_brightness(1.0);
}
if (id(counter) == 1) {
call.set_rgb(0.1, 1, 0.1); //Green color
call.set_brightness(0.5);
}
if (id(counter) == 2) {
call.set_rgb(1, 0.1, 0.1); //Red color
call.set_brightness(1);
}
if (id(counter) < 2) {
id(counter) += 1;
} else {
id(counter) = 0;
}
call.perform();