Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use 'psave' inside a preset, but works fine when sent via CURL #4451

Open
1 task done
PlasmaSoftUK opened this issue Jan 3, 2025 · 1 comment
Open
1 task done

Comments

@PlasmaSoftUK
Copy link

What happened?

Context: I would like a Preset, that I can trigger from a Playlist that saves the current state of the LEDs in to another Preset. For example:

{"psave" :20, "n": "Previous", "ib": true, "sb" : true}

Could be saved in a preset called 'Save State', when executed it would save the current LED state to Preset 20 called 'Previous'. I could then call these from a play list to Save the State, Perform an action like flash all lights red, then return the lights to their previous state.

Screenshot 2025-01-03 at 12 39 06

When I enter this in a preset and hit Save it says it is saved, but when I re-open the Preset, it has removed the first 2 parameters from the JSON and the preset subsequently doesn't work as expected.

Screenshot 2025-01-03 at 11 31 24

I have tested the JSON using CURL and when sent as a command via HTTP it works, and correctly save the current LED state in to Preset 20 called 'Previous':

Screenshot 2025-01-03 at 12 46 56

To Reproduce Bug

Attempt to save a Preset in the GUI with the following JSON content:

{"psave" :20, "n": "Previous", "ib": true, "sb" : true}

After saving if you re-open that preset the actual JSON content will be:
{"ib": true, "sb" : true}

This prevents it from performing the save to Preset 20.

Expected Behavior

I would expect to be able to add the above JSON to a preset, and be able to call that preset and have it save the current LED state in to Preset 20 just like it does when executed via CURL.

Install Method

Binary from WLED.me

What version of WLED?

0.15.0

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

No response

Anything else?

The idea behind being able to do this is to save the current state of the LEDs, trigger another short temporary action, then restore the previous LED state. For example ...

Doorbell Alert
Motion Alert
Any other form of Notification.

Currently the Alert can be triggered but if the lights were On previously, after the alert they will be off as you can only have one end state for the Playlist.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@blazoncek
Copy link
Collaborator

Technically impossible as "psave" is a directive that triggers saving a preset. If it was available within preset it would trigger recursive loop.

@blazoncek blazoncek removed the bug label Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants