Presets, Playlists and Timers
A preset is the state of the lights — every segment's colour, effect, palette and brightness — frozen under a name and a number. It is the unit of "the way I like it" in WLED: made once, applied in a tenth of a second, and the thing buttons, timers, automations and other apps all ultimately press.
What a preset really is
On the device, presets live in one
file: /presets.json on the
internal filesystem. Each preset is a
JSON object in exactly the state shape
of chapter 11, stored under its ID
(1–250 — the file reserves its top end
for the device itself), with an n
member holding its name and an optional
short label (two characters or one
emoji, for quick-glance lists). A spare
fact worth knowing: because LittleFS
dislikes lots of small random writes,
the project's own documentation advises
restraint — fifty-ish single-segment
presets or a dozen elaborate ones is
its suggested comfort zone, not the 250
the format allows.
A preset can hold an API command instead of a state. Untick "save current state" when creating it and the preset becomes a stored instruction — any HTTP or JSON API call. This is the modern form of the old macros, and chapter 12 hangs buttons and events off it.
Creating and applying presets from the web page is a two-tap job (Presets → + Preset; the save dialog asks which segments to include). Applying takes effect immediately and everywhere: the web page, the apps and the strip all see the same new state, because there is only one state (chapter 2).
Playlists: presets with a running order
A playlist is a preset whose object
contains a playlist member instead of
a static look. Read from the code that
parses it:
{ "playlist": {
"ps": [1, 4, 7],
"dur": [100, 300, 50],
"transition": [7, 7, 7],
"repeat": 0,
"end": 0 } }
ps— the preset IDs, in order;dur— how long each stays, in tenths of a second (100 means 10.0 s; a missing duration falls back to exactly that);transition— the crossfade into each, in the API's usual 100 ms units;repeat— how many extra times the whole list runs (0 means it loops until stopped; a negative value loops and shuffles the order, as does a separate"r": truemember);end— a preset to land on when a finite playlist finishes.
Playlists are how WLED does evenings: three looks that rotate through dinner, or a slow cycle through the holiday presets until the timer (below) turns everything off.
Timers and the nightlight
Two different clocks live in the Time & Macros settings:
Timed presets. Eight timer slots apply a chosen preset at a chosen time on chosen days, with the last two slots able to track sunrise and sunset instead (with an offset of up to ±120 minutes, and your location set on the same page). The countdown timer can fire a preset when it reaches its goal. This is the mechanism behind "porch lights at sunset, off at 23:00" with no hub and no cloud.
The nightlight is a gentler idea:
fade the lights from now to a target
brightness over a set number of minutes
— a landing light that puts itself to
bed. In the state object it is the nl
member (on, dur, mode, tbri,
and rem — the seconds remaining,
reported live). It can also fade up,
which makes it a passable sunrise alarm
when paired with a timer.
Both clocks depend on the device knowing the time: WLED takes it from the internet by NTP once online, with time zone and daylight-saving rules set in the same Time settings. A device that has never reached the internet keeps festival time of its own; if your timers fire at odd hours, chapter 17 starts there.