Hello to all
I am writing a usermode to access an SQL database and activate a certain preset status via applyPreset call. I haven’t found where certain parameters of the preset.json are after the program call. For some variables it is obvious that “bri” is in the variable bri , effectspeed and effectIntensity are also clear but in which variable is parameter “n” the name of the preset pname is not a global variable?
Do not rely on anything stored in presets.json. It may be entirely artificial and not deal with WLED state at all.
Use JSON API documentation at knowledge base.
Thanks for the answer, everything is correct, but it is different for me. I have written a usermode that puts WLED into deep sleep, which I can wake up again via a motion detector.
So that I have the same status after the deep sleep as I had before the deep sleep, I save the status via savePreset with index 250 and after waking up with applyPreset I restore the status.
I restore the status. I save the date and time in the name of the preset and would like to process this after waking up. But I can’t find the corresponding variable in which the “n” value is stored. I know the JSON description, but it doesn’t help.
Name (“n”) is not stored anywhere.
I found a solution. After cal from applyPreset() function i add following lines in my usermode
…
JsonObject fdo = doc.as();
HORDS_pname = fdo[“n”];
…
after that stands in variable HORDS_pname the name which looking for … is that ok for you ?
Is it ok for me? Does it really matter?
All I can tell you that this is not going to work after next release since applyPreset()
is not going to apply any presets in the future.
If you really want to get preset name use the logic in current applyPreset()
to load preset data into JsonDocument and parse it from there.
On the other hand is it really necessary for you to read/maintain preset names? Handling presets (and reading preset data from file system) is a very consuming operation and should be avoided at all costs.
Not really thank’s for support… I wrote in the meantime how I plan, ssh exec usermode to execute an script on my QNAP server at start of wled after deep sleep …
It works fine for me…