Creating a Save Current Button

Sorry if this is already documented somewhere and I didn’t find it yet, or I’m jut searching for the wrong terms, but I’m trying to do something which I think should be possible, but I’m not able to figure it out yet.

I’m working on an wled setup with a push button which I’d like it to be able to long press to save the current settings, and then short press to apply those saved settings. Think of a car’s radio quick tune button which has similar functionality.

The approach I’m trying to take are as follows:

  1. Create preset # 240 which saves the current settings to preset # 241
  2. Set Button’s long press to preset 240 (to save) and assign short press to 241 (to apply).

When I make a normal HTTP API call (from Chrome’s url bar) with the following, It works and saves the current settings into preset #241:
http://mywled.local/win&PS=241

The problem I’m running into is creation of the json or http api call in preset 240 which does the saving. This part does not work, as in when I try to use the following api call, it doesn’t actually save the current settings to preset #241 to same way the normal API call does.

Preset #240 - JSON:
{"state":{"psave":241,"n":"Button Apply"}}

Preset #240 - HTTP:
PS=241

My assumption is that I have the wrong API call in the preset and need to change the format to get this to work. Or maybe I found a bug? Can anyone help guide me with this?

GOAL: Construct a preset which saves current settings to another preset #?

Thanks!

I should note that I haven’t physically hooked the button up yet. I’ve been testing this through the presets menu and executing the presets from the web ui, not physical buttons.

Maybe there’s a difference? maybe I need to execute the save settings preset from the actual button and not the web ui?

Any help on this?

I was trying to make the exact same button setup and ran into this issue too. The API command would do nothing, and when trying to use JSON, the psave would just disappear when I clicked save on the preset.

The solution I found was to backup the preset file, manually add the psave parameter into the JSON file, and reupload the file. Then it works as expected (as long as you don’t edit the preset via the web interface). Seems it must be a problem with the web UI.