Toggle segments with button

Hi. I am trying to implement a fairly simple LED strip scenario that suddenly appears to be too complex for WLED, so I am looking for advice on how to implement it.

I have an addressable RGBW type LED strip and two buttons connected to a controller. I want to independently turn on and off one of the two segments of the LED strip by pressing the corresponding button. Also, a long press on either button should turn off both segments at once. The problem I ran into is that a short press on the button should trigger different macros depending on the current state of the segment, which is apparently not possible in WLED.

In addition, each button has a backlight (an LED connected to the controller on a GPIO pin), with which I would like to indicate the state of the corresponding segment of the LED strip (25% PWM for “off” and 100% PWM for “on”). This is not as important as the main functionality, but it is desirable.

Are there any ways to implement this scenario in WLED, or should I consider writing my own firmware?

You can write a usermod (for illuminating button LEDs).
Segment toggle is possible using {"seg":[{"id":X,"on":"t"},...]} JSON API, where X is your segment number.

It looks like a compromise, but thanks, it helped. Now there is one more question: can I display the palette on a segment as a static gradient? I mean, no animation. Reducing the animation speed to zero for some reason doesn’t stop it completely.

Nevermind, found “static” effects, works fine.

1 Like