2D and 1D Config/Presets on same LEDs

Is it possible to mix the 2D and 1D configurations on the same set of LEDs? I have been using WLED for years but have never messed with 2D until now.

I just installed three 2m strips of FCOB lights (20 addressable/m) vertically next to one another and have temporarily set them up as a 3x39 (one LED short on each segment to fit in the LED channel) matrix to test out the different effects. This all works well but I’d also like to use 1D effects and create segments for each strip with some effects. Is this possible?

Alternatively, is it also possible to save presets with the matrix ‘rotated’ in different orientations? While trying to set it up, I had the matrix set to “horizontal” accidently and it produced some cool looking effects, but for others I’d like it to be in the proper vertical orientation. I didn’t see an obvious way to accomplish this without changing the 2D configuration which ‘overrules’ the previously saved visual look of the presets.

After googling, the only references that I can find are related to setups with a matrix and strip combined into one data pin, but that doesn’t say anything about how to turn a matrix into a strip using segments or other methods.

2d-1d-Mixed-Setup info here
https://kno.wled.ge/advanced/2d-1d-Mixed-Setup/
To rotate the effects look at Transpose in the segment options

prity simple FIRST segment use the matrix
AND only config the real matrix in 2D setup

Then click new segment and just add to X the last LED in matrix
32x8 = 256 if you enter 256 then the segment will change to LINE 1D

To be clear, I don’t have any real matrix in the mix here just three 2m strips running parallel to one another along the wall like this: I I I

I’m hoping to save and use presets for this with it configured as a 2D matrix and as a 1D strip without having to alter the configuration after the initial setup and saving of each preset. (e.g. setup as 2D vertical matrix, save desired preset, reconfigure as 1D strip, save a second preset, and then later come back and select either preset with it displaying as it would at the time either preset was saved)

My case is unique from this as there is no actual matrix just three strips running parallel to one another that can function as a matrix (albeit with terrible resolution) or as a 1D strip. I’m hoping to save presets with it configured one way or the other and have them actually display that way even if the configuration has been changed (or ideally have a single configuration that can show these effects in either format).

In testing, the presets are overridden once the config has been changed and the effects appear differently than they did when the preset was initially saved with the prior config.

then i woudt go for only 1D and use only this
you can have 9 segments 3each this gives you quite nice effects

Thanks for the idea. I’ll have to play around with this and the offset to see if I can maybe replicate things more closely.

I just really liked how the Tartan effect looks with the strip configured as a horizontal matrix but wanted to also use some effects with it set as a vertical matrix and a 1D strip as well. Perhaps I’ll fall down a rabbit hole and learn how to make custom effects at some point :laughing:

So I was doing some more research last night thinking of different ways to accomplish this and I think it may be possible using the JSON API…? If you navigate to the [IP]/JSON page of the devicen it does show hw > led > matrix > panel > 0 > v = true/false (vertical oreitation true/false) but I have yet to figure out if these properties are configurable using an API call. I don’t know much about this but did some testing using curl commands with a template making a similar call but for mqtt instead.

Does anyone know if the “hw” parameters are changeable using the API? I think I had the call formatted correctly but it doesn’t seem to have stuck in the config.

My thought process here is using Home Assistant to select a preset and also send an API call to adapt the LED/2D configuration to what I’d like it to be for each specific effect. However, my lack of knowledge in this subject has been a roadblock. I will try some more attempts tonight.

I strongly suspect the configuration won’t be easily updated via the API (that’s my gut not definitive).

What is possible is the link between segments and their position on a matrix.
Checkout start, stop, startY, and stopY in the segment description of the JSON API.

That might give you some internal control over where a segement and its effect fall in a matrix setup.

Don’t know if that will give you any more control than you know about already…

The other possibility that comes to mind is to use ledmap(s) to change the virtual layout of your setup on the fly.

Thanks for the response!

I’m back home and tinkering some more. I’ve used ChatGPT for the very first time to help ensure that I’ve formatted my JSON correctly and it worked to enable/disable MQTT via the API, but I suspect that you’re correct about the configuration being blocked from changes via the API as it doesn’t seem to be working (though it is returning a response stating that v=true is “true”) no matter how I try it.

For posterity, here is the curl command:

curl -X POST http://[IP]/json/settings -H "Content-Type: application/json" -d "{"hw":{"led":{"matrix":{"panel":{"0":{"v":"true"}}}}}}"

I’ll have to play around with segments and spacing at some later date when I have more time to devote to it. It’s astounding how differently effects are displayed based on minute changes to LED/Segment layout (both physically and digitally) so it can be a bit overwhelming to try out all the variations multiplied by all the effects and colors.

I honestly never played with /json/cfg so I am just testing with you . You seem to have a lot of errors in your curl even if you do not get errors in the output , if you omit the x and y then the panel will be reset to 8x8 , you also changed “panels” to “panel” and used json/settings when the correct end point is /json/cfg ( you can use this end point to view the correct format)

The below worked for my testing but you have to reboot the unit for the change to take effects

curl -X POST http://10.0.6.21/json/cfg -H "Content-Type: application/json" -d "{"hw":{"led":{"matrix":{"mpc":1,"panels":[{"b":false,"r":false,"v":true,"s":true,"x":0,"y":0,"h":16,"w":16}]}}}}"

I forgot to mention I am testing with DDP so that might also add something to the mix

Another edit: it is enough after you issue the command to go to the 2D page and hit save without reboot ( I recall there is something added to that page to reset the 2D hence you see the panel go to yellow ) I will try to see if there is a way to do that from command

1 Like

This works!

As I said I’m not experienced with JSON so I didn’t realize that I needed to include all the fields even if I wasn’t making any changes to them and didn’t notice the obvious errors like “panels” vs “panel” or using the wrong endpoint. I’ve just been somewhat fumbling my way through this :sweat_smile:

I paired it with a second curl command to do a reboot and I can successfully alter the 2D config (and resulting preset appearance) with a simple API call! Now to integrate this into Home Assistant so I can just click a single preset button and have an automation do all this for me automatically.

Set the matrix to a horizontal orientation:

curl -X POST http://192.168.0.85/json/cfg -H "Content-Type: application/json" -d "{"hw":{"led":{"matrix":{"mpc":1,"panels":[{"b":true,"r":true,"v":false,"s":true,"x":0,"y":0,"h":39,"w":3}]}}}}"

curl -X POST http://192.168.0.85/json/state -H "Content-Type: application/json" -d "{"rb":true}"

And this sets it to a vertical orientation:

curl -X POST http://192.168.0.85/json/cfg -H "Content-Type: application/json" -d "{"hw":{"led":{"matrix":{"mpc":1,"panels":[{"b":true,"r":true,"v":true,"s":true,"x":0,"y":0,"h":39,"w":3}]}}}}"

curl -X POST http://192.168.0.85/json/state -H "Content-Type: application/json" -d "{"rb":true}"

I can’t thank you enough for the help!

1 Like

You are most welcome , I was still in the process to find a way to change 2D page setup without a reboot ( because reboot is not needed if you do the changes from ui ) but if you are fine with it then I will no longer try now but will keep that on the to do list as its needs digging into code.

1 Like

During testing with Home Assistant, it does seem to function correctly for the most part but isn’t very robust due to the reboots. I suspect that post-reboot, it takes a little while for the controller to reconnect and accept any additional changes (such as changing the preset) which is why it only works some of the time. I even tried adding a few second delay between the reboot and selecting a new preset, but even with a 5 second delay, it still only works some of the time though it does get a bit more reliable the with larger delays like 10 seconds.

I think this will get me by for the time being, but if you happen to come across a way to reset the lights without a reboot, please do reply with a solution!

Again, I appreciate your help with this!

Found a quick dirty fix ( I am sure we can make it shorter )
Using the inspect tool firefox developer version

First use the curl we used before to change the “v”:true

curl -X POST http://10.0.6.21/json/cfg -H "Content-Type: application/json" -d "{"hw":{"led":{"matrix":{"mpc":1,"panels":[{"b":false,"r":false,"v":true,"s":true,"x":0,"y":0,"h":16,"w":16}]}}}}"

Then use the curl below that would rest the display

curl "http://10.0.6.21/settings/2D" -X POST -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:134.0) Gecko/20100101 Firefox/134.0" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Language: en-US,en;q=0.5" -H "Accept-Encoding: gzip, deflate" -H "Content-Type: application/x-www-form-urlencoded" -H "Origin: http://10.0.6.21" -H "Connection: keep-alive" -H "Referer: http://10.0.6.21/settings/2D" -H "Upgrade-Insecure-Requests: 1" -H "Priority: u=0, i" --data-raw "SOMP=1&PW=16&PH=16&MPH=1&MPV=1&PB=0&PR=0&PV=0&MPC=1&P0B=0&P0R=0&P0V=1&P0S=on&P0W=16&P0H=16&P0X=0&P0Y=0&data="

Just take note of the difference when Orientation changes in the 2nd curl its the P0V=1 ( P0V=0 is false )

As said this is very dirty but works for now because I tried to get the input from the dev who made the change but got only a clue that “Clicking save, issues POST request with UI data” so it was easier to get the post from the inspector

Edit: You just need the 2nd curl and no need for the first command

The two command below will switch vertical and horizontal Orientation of the panel and will also reset the display

curl "http://10.0.6.21/settings/2D" -X POST   -H "Content-Type: application/x-www-form-urlencoded"  -H "Priority: u=0, i" --data-raw "SOMP=1&PW=16&PH=16&MPH=1&MPV=1&PB=0&PR=0&PV=0&MPC=1&P0B=0&P0R=0&P0V=1&P0S=on&P0W=16&P0H=16&P0X=0&P0Y=0&data="
curl "http://10.0.6.21/settings/2D" -X POST   -H "Content-Type: application/x-www-form-urlencoded"  -H "Priority: u=0, i" --data-raw "SOMP=1&PW=16&PH=16&MPH=1&MPV=1&PB=0&PR=0&PV=0&MPC=1&P0B=0&P0R=0&P0V=0&P0S=on&P0W=16&P0H=16&P0X=0&P0Y=0&data=" 

So yeah it is much shorter now

1 Like

Small video of how to revers engineer anything in ui to use with curl
hack_anyui_curl

1 Like

This works flawlessly, and with your tutorial video, I was also able to capture the POST information for a 1D strip. Fantastic!!

In Home Assistant, I’m now able to click a single button and have WLED reconfigure itself between 2D vertical, 2D horizontal, or 1D and select an accompanying preset to go with it!

Here’s the curl for 1D using my personal strip length (3x39 LEDs):

curl "http://192.168.0.85/settings/2D" -X POST   -H "Content-Type: application/x-www-form-urlencoded"  -H "Priority: u=0, i" --data-raw "SOMP=0&PW=3&PH=39&MPH=1&MPV=1&PB=0&PR=0&PV=0&MPC=1&data="

If some future individual would like to replicate this all in HA

  1. You’ll need to convert these curl commands into RESTful commands in the config file:
rest_command:
  officewall_vertical:
    url: !secret wled_cfg_post_address
    method: POST
    payload:  'SOMP=1&PW=3&PH=39&MPH=1&MPV=1&PB=0&PR=0&PV=0&MPC=1&P0B=1&P0R=1&P0V=1&P0S=on&P0W=3&P0H=39&P0X=0&P0Y=0&data='
    content_type:  'application/x-www-form-urlencoded'  
  officewall_horizontal:
    url: !secret wled_cfg_post_address
    method: POST
    payload:  'SOMP=1&PW=3&PH=39&MPH=1&MPV=1&PB=0&PR=0&PV=0&MPC=1&P0B=1&P0R=1&P0V=0&P0S=on&P0W=3&P0H=39&P0X=0&P0Y=0&data='
    content_type:  'application/x-www-form-urlencoded'  
  officewall_1d:
    url: !secret wled_cfg_post_address
    method: POST
    payload:  'SOMP=0&PW=3&PH=39&MPH=1&MPV=1&PB=0&PR=0&PV=0&MPC=1&data='
    content_type:  'application/x-www-form-urlencoded' 
  1. Create a button in the Helper UI for each desired preset (2DV, 2DH, or 1D and preset e.g. 2DH Tartan, 2DV Julia, 1D Bouncing Balls)
  2. Create a script in the Automation UI that sends the REST command, delays for 500ms, and then selects the desired preset from the list.
  3. Create an automation that calls the script when the button is pressed

And viola! You’re off to the races.

Edit: I wonder if you can simply store (current effect) or (current state) to a variable and then use the 2DH, 2DV, 1D buttons to see your pattern in each format.

Back to the drawing board!

If you want to save current effect to a preset ( if this is the question ) then use something like

{"psave":24,"n":"Oct28","ib":true,"sb":true}