Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
https://kno.wled.ge
MIT License
14.57k stars 3.12k forks source link

How to turn on/off a specific segment without turn pn/off all others #652

Closed nmsoares closed 4 years ago

nmsoares commented 4 years ago

I'm running version 0.9.0-b1 and I've setup segments ... Very Cool!...but how to turn on/off a specific segment without turning on/off all others ???

brentbrooks70 commented 4 years ago

@nmsoares this is close to #511, although it is in use with API. From the GUI it is probably easiest right now to set it to solid black. If you want it to maintain colors and effects then deleting the segment will turn it off and redefining it will turn it back on to previous config as per #511.

nmsoares commented 4 years ago

Thanks for the information @brentbrooks70 .Can you share the command ? I'm struggling to find the MQTT commands to set to black on a segment.

Def3nder commented 4 years ago

Hi @nmsoares, unfortunately you can only change segements (other than the 1st one) through the JSON API. So you need a client that can send a JSON POST request to WLED.

Aircoookie commented 4 years ago

There actually is a command in the HTTP to select the segment to which to apply changes: win&SM=[segment number]. I have to admit though that it is not well tested and may have side effects, that's the reason it isn't documented right now.

Def3nder commented 4 years ago

Thx @Aircoookie !

@nmsoares, as the segment commands are parsed in the very beginning this should work then:

Assuming the we have 3 segments: seg0 {0 to 50}, seg1 {50 to 100} and seg2 {100 to 150} and we want to turn off seg1: http://[WLED-IP]/win&SS=1&S2=0 or send a payload with win&SS=1&S2=0 to /WLED/[WLED-name]/api

For re-enabling the segment your need to know the segment-end - this command would do the trick: http://[WLED-IP]/win&SS=1&S2=100

Doing this should not change any color or effect running on that segment - this should all stay in place.

nmsoares commented 4 years ago

Thanks @Aircoookie & @Def3nder ! TOP!!!!

Def3nder commented 4 years ago

Hi @nmsoares, could you pls. close the issue, if you are satisfied with the results ? Thx a lot !