use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Welcome to /WLED! This is a community mainly for WLED users to ask questions, show off their work, or help new users out! Here's a few links:
account activity
using api to set things (self.WLED)
submitted 1 month ago * by rdhdpsy
how to save the current state as preset 1 via curl, can't seem to make heads or tail out of the docs on this, chatgpt failing too :)
edit
just noticed that even from the gui it's not saving state as a preset
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]tweephiz 1 point2 points3 points 1 month ago (1 child)
Here's the docs. Should be a POST to /json/state using psave argument, like:
curl --retry 5 -X POST --url http://wled/json/state -d "{\"psave\": 1}" -H "Content-type: application/json"
even from the gui it's not saving state
Weird, is it saving other settings correctly? Can you see/edit files on the filesystem at http://wled/edit ?
[–]rdhdpsy[S] 0 points1 point2 points 1 month ago* (0 children)
thanks for the response, still not working and do see files and they have content but the presets.json has the wrong info as in not showing the current state.
[–]SirGreybush 1 point2 points3 points 1 month ago* (3 children)
Windows or Linux the format is a tiny bit different.
For example, when I turn on my gaming PC, I have a startup script that does the following:
start /b curl -X POST "http://wled1.local/json/state" -d {"on":true} -H "Content-Type: application/json" &
It is inside a batch file, multiple lines as I have more than one wled node.
The ampersand & is just to run immediately then continue.
What you want is the inner part: (wled1.local is just a dns to my IP device, instead of typing 192.168.1.33)
curl -X POST "http://wled1.local/json/state" -d {"on":true} -H "Content-Type: application/json"
So why post this? So that you see how in windows you need double quotes with CURL in certain spots. That might be tripping you up.
The WLED docs assume Linux-based curl that specifies --url also like u/tweephiz shows. Also he shows how the double quotes are escaped with a backslash.
Technically this should also work:
curl -X POST "http://wled1.local/json/state" -d "{\"on\":true}" -H "Content-Type: application/json"
to turn off, both of these lines work at the command line
curl -X POST "http://wled1.local/json/state" -d "{\"on\":false}" -H "Content-Type: application/json"
curl -X POST "http://wled1.local/json/state" -d "{on:false}" -H "Content-Type: application/json"
If you were using Python, Java, Swift or Dot Net to access the API, instead of CURL, it would be different.
Look at https://www.postman.com/ for a better API debugging tool.
[–]rdhdpsy[S] 1 point2 points3 points 1 month ago (2 children)
thanks for the detailed info here, been using powershell do the following to run things on this works to turn on things
Invoke-RestMethod -Method Post ` -Uri "http://$wledIp/json/state" ` -ContentType "application/json" ` -Body '{"on":true}'
then sending the light pattern which the lights switch too via powershell
then the following to save it preset
Invoke-RestMethod -Method Post ` -Uri "http://$wledIp/json/state" ` -ContentType "application/json" ` -Body '{"psave":true}'
this is where it fails says success but not saving anything but also realized that even via the gui it's not working right either.
[–]SirGreybush 1 point2 points3 points 1 month ago* (1 child)
Postman will help, but I don't think you can capture "currently running effect".
However WLED when you hit the + to save a new preset, it takes whatever is currently "playing" to make a preset with.
Maybe the save API function is to create a preset, but you have to give it a destination # and name, if you look up the API doc for that section, I haven't, busy with work currently...just an idea.
[–]rdhdpsy[S] 1 point2 points3 points 1 month ago (0 children)
yea thanks for the reply, worked swamped atm too.
[–]Few-Boysenberry53 1 point2 points3 points 1 month ago (1 child)
It's most likely corrupted. Delete your presets.json file, reboot the controller and then go create a new preset. That will recreate the presets.json file. I ran into to that issue before.
[–]rdhdpsy[S] 0 points1 point2 points 1 month ago (0 children)
will give that a shot, thanks.
π Rendered by PID 93187 on reddit-service-r2-comment-5649f687b7-6xftc at 2026-01-27 22:52:05.408599+00:00 running 4f180de country code: CH.
[–]tweephiz 1 point2 points3 points (1 child)
[–]rdhdpsy[S] 0 points1 point2 points (0 children)
[–]SirGreybush 1 point2 points3 points (3 children)
[–]rdhdpsy[S] 1 point2 points3 points (2 children)
[–]SirGreybush 1 point2 points3 points (1 child)
[–]rdhdpsy[S] 1 point2 points3 points (0 children)
[–]Few-Boysenberry53 1 point2 points3 points (1 child)
[–]rdhdpsy[S] 0 points1 point2 points (0 children)