Commit 71cadf0
authored
Upgrade WLED.NET JSON API coverage and ergonomics (#15)
* Add roadmap plans for full WLED JSON API coverage
* Plan 0: multi-target net8/9/10 and modernise toolchain
* Plan 1: core value types and enums
* Plan 2: command-value types and fluent state/segment builders
* Plan 3: complete the state object with typed fields and write-only commands
* Plan 4: complete the segment object with colors, effect params and 2D fields
* Plan 5: complete info object and add si/net/live read endpoints
* Plan 6: presets API with list, apply, save and delete
* Plan 7: playlists API with typed entries and parallel-array transform
* Plan 8: per-segment individual LED control with auto-chunking
* Plan 9: effect metadata parsing from /json/fxdata
* Plan 10: config API with safe partial writes and node discovery
* Plan 11: client ergonomics, typed exceptions, cancellation and DI
- Add intent methods (TurnOn/TurnOff/Toggle/SetBrightness/SetColor/SetEffect/SetPalette/Reboot)
- Add CancellationToken to every client method
- Add typed exception hierarchy (WledException + connection/response/version)
- Add HttpClient constructor and Kevsoft.WLED.DependencyInjection AddWledClient
- Add intent, exception and DI tests
* Plan 11: refresh README with feature matrix, add CHANGELOG and modern sample
- Rewrite README around intent methods, fluent builders, DI and error handling
- Add a supported-features capability matrix and document target frameworks
- Add CHANGELOG.md (Keep a Changelog format)
- Rewrite BasicConsole sample to showcase the ergonomic API
* Add WLED JSON API coverage review
* Add plan 12: usability and correctness improvements from review
* Widen transition (transition/tt) from byte to ushort to support 0-65535 range
* Add ranged-random effect/palette selector (Selector.RandomInRange, 'from~tor')
* Widen ColorTemperature Kelvin range to 1000-20000 and add KelvinUnchecked escape hatch
* Fix no-id intent methods to target selected segments via seg object form
Model the state 'seg' field as a union (SegmentPayload) that serializes as either
an object (selected segments) or an array (id-targeted), matching the WLED API.
No-id SetColor/SetEffect/SetPalette now emit the object form instead of an array
that WLED would infer as id:0.
* Add typed config fields for identity mDNS, MQTT and boot defaults
Model id.mdns, if.mqtt (en/broker/port/user/cid) and def (on/bri/ps) as typed
properties while keeping JsonExtensionData as an escape hatch for everything else.
* Update README, CHANGELOG and sample for post-review API changes
* Add plan 13 for device ergonomics and agent guidance
* Add AGENTS.md and typed effect/palette catalogs
Add root AGENTS.md with project conventions, commands and gotchas.
Add EffectCatalog/PaletteCatalog with id/name lookup, reserved-entry
filtering (RSVD/-), and SetEffect/SetPalette catalog-entry overloads.
* Add SelectedSegments fluent update for selected-segment object form
StateUpdate.SelectedSegments(...) targets the selected segments via the
seg object form and accumulates across calls. Mixing it with Segment(id, ...)
in one update throws, since WLED's seg field is one form or the other.
* Add cohesive WLedDevice snapshot via GetDevice()
GetDevice() issues a single GET /json and exposes state, info and typed
effect/palette catalogs as one snapshot, with per-segment effect/palette
resolution and derived helpers (SelectedSegments, ActiveSegments,
SupportsWhiteChannel, etc). Effect metadata is opt-in to avoid extra requests.
* Make effect metadata actionable
Add lookup helpers (FindById/FindByName/Try*) over effect metadata
collections, plus SegmentUpdate.Effect(EffectMetadata) and
ApplyEffectDefaults(EffectMetadata) to set speed/intensity/custom sliders
from metadata defaults (c3 clamped to 0-31).
* Add strong id and range value types
Introduce SegmentId, EffectId, PaletteId, PresetId, PlaylistId,
LedMapId, SegmentBounds and MatrixBounds readonly structs with range
validation, equality and netstandard2.0-safe hashing. Wire SegmentBounds
and MatrixBounds into SegmentUpdate.Range/Range2D and LedMapId into
StateUpdate.LoadLedMap as non-ambiguous overloads.
* Add fluent config update builder
Introduce ConfigUpdate and an UpdateConfig(Action<ConfigUpdate>) client
overload exposing Identity, Mqtt and BootDefaults helpers. Only touched
sections and fields are serialised, reusing the existing network opt-in
guard.
* Document Plan 13 ergonomics features
Add README sections and feature-matrix rows for the device snapshot,
catalogs, selected-segment updates, strong value types and the fluent
config builder; expand the CHANGELOG and BasicConsole sample to match.
* Remove outdated gotchas from AGENTS.md for clarity and conciseness
* Fix Docker build for DependencyInjection project
Copy the Kevsoft.WLED.DependencyInjection csproj and sources so dotnet
restore (which reads the solution) and the build/pack stages succeed.
Build the DI project (transitively building the main library) instead of
globbing multiple csproj into a single dotnet build, and pack each
packable library explicitly. Also align FROM..AS keyword casing.1 parent 03c81a8 commit 71cadf0
137 files changed
Lines changed: 10058 additions & 135 deletions
File tree
- plans
- reviews
- samples/BasicConsole
- src
- Kevsoft.WLED.DependencyInjection
- Kevsoft.WLED
- Commands
- Config
- Exceptions
- Fluent
- test/Kevsoft.WLED.Tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | | - | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | | - | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | | - | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | | - | |
| 30 | + | |
29 | 31 | | |
30 | | - | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | | - | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
0 commit comments