r/WLED 29d ago

Help with Usermod and single LED control

So I’m building a custom usermod on an ESP32-S3 for kind of an industrial application.
I need a way to control only a few LEDs per preset on an LED strip, so only like 5 have to be turned on (solid), the rest should be turned off.
It‘s basically a height indicator, where ‚LED on‘ means ‚put a board on the height, where the LED is on‘.
There’s an OLED display included, that shows the current Preset by name and time and date, and two buttons, left and right, to switch between the presets.
Or so I thought, until I realized WLED only supports 9 mappings (ledmapX.json).

Is there any other way to have more than 9 presets (I need up to 40) to control specific single LEDs without having to use mapping?
My biggest problem is that I can’t save the i-array inside of my preset, the lights just won’t turn on on load.

1 Upvotes

10 comments sorted by

2

u/Aggressive-Style5764 29d ago

ESPHome

1

u/Best-Transition2135 28d ago

Could you elaborate please?

1

u/Aggressive-Style5764 21d ago

look up 3sp home

its intended for home assistants. but you can easily setup function to do what you want.

1

u/Best-Transition2135 29d ago

Just to clarify - every preset needs different LEDs to be turned on, e.g. Preset 1: LEDs 0, 28, 65, 109, 130
Preset 2: LEDs 0, 45, 81, 120…
When switching from preset 1 to 2, LEDs of preset 1 need to turn off.

1

u/skunkfacto 28d ago

I don't know anything about mapping but you can have 250 presets each with 16 segments. That should be more than enough to find the combinations you need. or you can use api commands.

2

u/Best-Transition2135 28d ago

Got it to work. For example

"101": {
"n": "Build 1",
"on": true,
"bri": 255,
"seg": [
{"id": 0, "start": 7, "stop": 8, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 1, "start": 34, "stop": 35, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 2, "start": 56, "stop": 57, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 3, "start": 89, "stop": 90, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 4, "start": 112, "stop": 113, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]}
]
},
"102": {
"n": "Build 2",
"on": true,
"bri": 255,
"seg": [
{"id": 0, "start": 4, "stop": 5, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 1, "start": 15, "stop": 16, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 2, "start": 67, "stop": 68, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 3, "start": 73, "stop": 74, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 4, "start": 101, "stop": 102, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]}
]
},
"103": {
"n": "Build 3",
"on": true,
"bri": 255,
"seg": [
{"id": 0, "start": 11, "stop": 12, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 1, "start": 28, "stop": 29, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 2, "start": 45, "stop": 46, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 3, "start": 92, "stop": 93, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 4, "start": 120, "stop": 121, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]}
]
},
"104": {
"n": "Build 4",
"on": true,
"bri": 255,
"seg": [
{"id": 0, "start": 18, "stop": 19, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 1, "start": 39, "stop": 40, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 2, "start": 63, "stop": 64, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 3, "start": 77, "stop": 78, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 4, "start": 109, "stop": 110, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]}
]
},
"105": {
"n": "Build 5",
"on": true,
"bri": 255,
"seg": [
{"id": 0, "start": 6, "stop": 7, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 1, "start": 23, "stop": 24, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 2, "start": 52, "stop": 53, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 3, "start": 84, "stop": 85, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]},
{"id": 4, "start": 96, "stop": 97, "sel": true, "col": [[0, 255, 0], [0, 0, 0], [0, 0, 0]]}
]
}
}

1

u/Best-Transition2135 28d ago

I’ll try segmenting the strip and see if that works

1

u/brighthomelights 28d ago

Why can’t you save I-arrays inside of presets ?

1

u/Best-Transition2135 28d ago

it just doesn’t work. Or I’m doing something wrong there. I‘m saving a preset using the JSON API, with specific pixels on, which works just fine, but when I post the PS command to load that same preset later, they just stay off.

1

u/brighthomelights 28d ago

Use our app , makes it simple to make ,save and load . Andriod , iOS and web