Control additional GPIO with http or mqtt

Dear all,

i added some spots to my WS2812B Stripe and would like to switch them on/off separately from the stripe. I read the wiki that this need to be done by own code extensions - but it references to the EspalexaDevice as a starting point for own extensions.

As the very basic first step i can compile the wled code with arduiono IDE

My goal is to control those additional pins just with http requests or something else - maybe some of you guys had gone this way already and can provide me with helpful informations and/or code examples ?

may thanks !
Tom

After reading over your wishes a couple times, I’ll answer the questions that might help you get to the end more easily.

  1. Q: Should I use the Arduino IDE or VS Code & Platform IO to compile and develop a usermod?
    A: VS Code & PlatformIO plugin work great with WLED and make it super easy to compile. Plus it gives context sensitive suggested text and provided colorized text to help find mistakes while typing rather than while compiling (and interpreting the errors correctly).
  2. Q: What is a good way to approach developing a new WLED usermod?
    A: Get an existing usermod that does at least one thing you want to do in your usermod compiling & working. Then do it again with a different usermod that does something else your usermod needs to do. Then blend the 2 usermods together, and make them both work together. Lastly, modify that blended set of usermods to do what it is you want.

So, find a usermod that accepts input from HTTP / JSON API (or mqtt if that fits your existing HA setup better). After your usermod-in-progress successfully toggles some WLED feature (like strip on/off), add the pin controls you need in setup(), and in loop(), where it was turning the strip on/off, toggle the pin(s) for your SPOT(S).

Hopefully I understood what you want.
However, if for some reason I am wrong and you broke the LED strip apart and inserted SPOTs at several locations along the LED strip that operate exactly like an RGB pixel on the WS2812B, the answer is SEGMENTS. Each SPOT gets its very own segment.
Then your usermod can simply control the segment for each spot without any PINs.

Thanks so far for your suggestions.

Yes, my intention is to use extra GPIO for driving additional single LEDs - that means just change the state for those GPIO to high or low.

If anybody know a usermod like that, it would be a great help.