Push button for each segment

Hello everyone,

This is my first post. I tried searching for an answer but I couldn’t find one. In my current set up I have 4 segments (each on their own channel). I also have 4 push buttons that are connected to my esp32 and are working properly. The buttons can load presets and toggle the system power with out issue.

However, I would like to set it up so that the buttons to toggle each segment individually. I can’t seem to figure it out. ie

button 1 → toggles segment 1 on/off
button 2 → toggles segment 2 on/off
button 3 → toggles segment 3 on/off
button 4 → toggles segment 4 on/off

Is this possible? Thank you in advance for any assistance

You can create a preset that contains the API toggle commands.
You manually enter the commands into the “API Command” window (turn off the OverWrite with State option)
You might also create 2 presets for each segment - one On and the other Off.
You can cycle between them with " win&P1=x&P2=y&PL=~" where x is the On preset # and y is the Off #.
Note, the presets must be sequential for this to work.

omg, awesome. that looks promising. I can’t wait to get home from work and try it out. thank you! thank you!

use: {"seg":{"id":X,"on":"t"}} and replace X with your desired segment.
This will toggle segment X power on or off.

1 Like


Thanks blazoncek. I am assuming that I have applied this wrong. I can’t just past this code into a preset right? Do I need to apply the code in one of the json files? Sorry I’m such a newb at this.

that should be enough. if it doesn’t work, use [] around inner {} like:
{"seg":[{"id":X,"on":"t"}]}

It work perfect!!! thank you so much blazoncek. I should buy you a beer. :beers:

it also works with out the [ ]. i just verified it. Maybe i did something dumb before and didn’t save it or something. :grin:

Discord has my PayPal link. :wink:
An I do enjoy beer. :rofl:

1 Like

Tell me what I’m doing wrong?

  1. I have four different tape channels connected to different esp32 pins.

  2. I have four buttons connected to different esp32 pins.

  3. I created four different segments with the number of LEDs.

  4. Then I created four presets with the codes:
    {“seg”:[{“id”:1,“on”:“t”}]}
    {“seg”:[{“id”:2,“on”:“t”}]}
    {“seg”:[{“id”:3,“on”:“t”}]}
    {“seg”:[{“id”:4,“on”:“t”}]}
    I don’t have any more code in my persets. Accordingly, all these segments then disappear from me and the preset cannot include any segment.

Please help me, what am I doing wrong?

A note for future visitors.
It was established on Discord that @Lukin.M.s did not store segments into boot preset.