-
Notifications
You must be signed in to change notification settings - Fork 459
added random playlist example in json-api.md #276
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
Open
AlexeyMal
wants to merge
4
commits into
wled:main
Choose a base branch
from
AlexeyMal:patch-3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarify what this numeric-key JSON payload is for (
"9"playlist +"12"preset), and which endpoint to POST to.This example uses top-level numeric keys
"9"and"12"to define both a playlist and a preset in one payload, which differs from the earlier sample that uses a top-level"playlist": { ... }object. The section doesn’t explain whether this form is meant to:/json,/json/state,/json/cfg, etc.).Please add one short sentence under the code block (or adjust the example heading) clarifying the intended usage and endpoint so users don’t copy a payload that does nothing.
🤖 Prompt for AI Agents
🧩 Analysis chain
🏁 Script executed:
Repository: wled/WLED-Docs
Length of output: 2773
🏁 Script executed:
Repository: wled/WLED-Docs
Length of output: 448
🏁 Script executed:
Repository: wled/WLED-Docs
Length of output: 40
🏁 Script executed:
Repository: wled/WLED-Docs
Length of output: 549
🏁 Script executed:
Repository: wled/WLED-Docs
Length of output: 40
🏁 Script executed:
Repository: wled/WLED-Docs
Length of output: 40
🏁 Script executed:
Repository: wled/WLED-Docs
Length of output: 40
🏁 Script executed:
Repository: wled/WLED-Docs
Length of output: 696
🏁 Script executed:
Repository: wled/WLED-Docs
Length of output: 2742
🏁 Script executed:
Repository: wled/WLED-Docs
Length of output: 219
🏁 Script executed:
Repository: wled/WLED-Docs
Length of output: 1022
🏁 Script executed:
Repository: wled/WLED-Docs
Length of output: 2159
Remove or document the
playlist.rfield in the example.The example includes
"r": falseinside the playlist object, but the Playlist object table above lists onlyps,dur,transition,repeat, andendas valid fields. The documented uses of"r"elsewhere in this file (for segment properties likecol,fx, andpal) indicate random values at the segment level, not the playlist level. Either document whatrmeans for playlists in the table, or remove it from the example to align with the documented schema.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sample playlist JSON includes an undocumented "r" field inside the playlist object. Remove that "r" property from the example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlexeyMal, here is the corrected JSON with"r":falseremoved from the playlist object:{ "9":{"playlist":{"ps":[12],"dur":[600],"transition":[30],"repeat":0,"end":0},"on":true,"n":"AllRandomPlaylist"}, "12":{"bri":255,"mainseg":0,"on":true,"seg":[{"bri":255,"c1":128,"c2":128,"c3":16,"cct":127,"col":["r",[0,0,0],"r"],"frz":false,"fx":"r","grp":1,"id":0,"ix":128,"m12":1,"mi":false,"o1":false,"o2":false,"o3":false,"of":0,"on":true,"pal":"r","rev":false,"sel":true,"set":0,"si":0,"spc":0,"start":0,"stop":50,"sx":128,"fxdef":true}],"transition":7,"n":"random effect"} }The only change is removing
"r":false,from theplaylistobject inside key"9", aligning the example with the documented schema (ps,dur,transition,repeat,end).🧠 Learnings used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verify each finding against the current code and only fix it if needed.
In
@docs/interfaces/json-api.mdaround lines 348 - 356, The example usestop-level numeric keys "9" (playlist object with "playlist":{...}) and "12"
(preset/preset segment under "seg":{...}); add one short clarifying sentence
below the JSON explaining that those numeric keys are resource IDs (playlist ID
9 and preset ID 12), that POSTing this payload to /json/cfg will persist/save
both the playlist and preset, and that to apply a playlist immediately you would
instead POST an appropriate state update to /json/state (or use the "playlist"
command) — reference the "9" playlist and "12" preset in the sentence so readers
know which parts are persisted vs applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 8
🏁 Script executed:
Length of output: 11074
@AlexeyMal, I've verified against the repository. The finding is valid — a clarifying sentence is needed. However, I want to correct one detail from the original review comment:/json/cfgis WLED's device configuration endpoint (cfg.json), not for presets. Presets are stored inpresets.jsonand the correct way to upload them is via the/editfilesystem manager page, as confirmed indocs/features/presets.md.Here is the suggested addition (one sentence) to place directly below the JSON code block:
So the updated section would look like:
These numeric keys (
"9"and"12") are resource IDs — playlist ID 9 and preset ID 12 — stored in WLED's internalpresets.jsonfile; upload this payload to your device via the/editpage to persist both entries, then apply the saved playlist by POSTing{"ps":9}to/json/state.Learnt from: softhack007
Repo: wled/WLED-Docs PR: 310
File: docs/basics/faq.md:321-326
Timestamp: 2026-05-01T12:10:43.108Z
Learning: When documenting or advising about WLED licensing/distribution under EUPL-1.2, treat WLED build environment files such as platformio.ini and platformio_override.ini as part of the firmware source code: they are required to rebuild the firmware and must be shared with recipients when distributing a modified WLED build. In contrast, treat LittleFS runtime user data/config files (e.g., presets.json, cfg.json, ledmap.json, etc.) as runtime user data that are not subject to this source-code disclosure requirement. Ensure your documentation reflects this distinction consistently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlexeyMal, here is the plan to apply both changes to the PR:Changes to
docs/interfaces/json-api.md"r":falsefrom the playlist object in the JSON example🧠 Learnings used
Failed to handle agent chat message. Please try again.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlexeyMal you might have found out already - coderabbit is a review expert AI, but it won't rewrite the PR for you. This is intended :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderabbitai it is not necessary to upload a (single) custom preset/playlist (JSON format) via network API, /edit or /json/ endpoints. The simpler solution is to directly enter JSON into the WebUI when saving a preset (un-check "Use current state" => textbox "API command"). see my comment #276 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@softhack007, thanks for the correction — noted! You're right that the WebUI approach (presets page → un-check "Use current state" → paste JSON into the "API command" textbox) is simpler and should be the primary recommendation, not the secondary "Alternatively..." one.The clarifying sentence should be reordered to lead with the WebUI method:
✏️ Learnings added
🧠 Learnings used