Skip to content

Commit 1e0c70e

Browse files
committed
Update README, CHANGELOG and sample for post-review API changes
1 parent 48cc290 commit 1e0c70e

3 files changed

Lines changed: 29 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ rather than deprecated, so consuming code must be updated.
3939
request types, preventing accidental round-tripping of read-only fields.
4040
- Posting state is now done through intent methods or `UpdateState(...)` rather than mutating
4141
and re-posting a response object.
42+
- **`SetColor`/`SetEffect`/`SetPalette` with no `segmentId` now target the *selected* segments**
43+
(the WLED `"seg":{…}` object form) instead of segment 0. The state `seg` field is modelled as
44+
a `SegmentPayload` union that serialises as either an object (selected segments) or an array
45+
(id-targeted).
46+
- **Transition values (`transition`/`tt`) widened from `byte` to `ushort`** to support the
47+
documented `0–65535` range (~109 minutes) instead of clamping at 25.5 s.
48+
- **`ColorTemperature.Kelvin` range widened to `1000–20000 K`** to match the docs' forward-
49+
compatible guidance, with a new `ColorTemperature.KelvinUnchecked(int)` escape hatch for
50+
values outside that range.
51+
52+
### Added
53+
54+
- **Ranged-random effect/palette selection** via `Selector.RandomInRange(from, to)`
55+
(the WLED `"from~tor"` token).
56+
- **Typed device-configuration fields** for `id.mdns`, `if.mqtt` (`en`/`broker`/`port`/`user`/`cid`)
57+
and `def` (`on`/`bri`/`ps`), while preserving all other keys through `JsonExtensionData`.
4258

4359
### Removed
4460

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,19 @@ await client.TurnOff();
5151
await client.Toggle();
5252

5353
await client.SetBrightness(200);
54-
await client.SetColor(RgbColor.FromHex("FFAA00"));
55-
await client.SetEffect(9); // by effect id
56-
await client.SetPalette(11); // by palette id
54+
await client.SetColor(RgbColor.FromHex("FFAA00")); // selected segments
55+
await client.SetColor(RgbColor.FromHex("FFAA00"), segmentId: 1);
56+
await client.SetEffect(9); // by effect id
57+
await client.SetPalette(11); // by palette id
58+
await client.SetEffect(Selector.Random); // random effect
59+
await client.SetPalette(Selector.RandomInRange(5, 10)); // random palette in a range
5760
5861
await client.Reboot();
5962
```
6063

64+
With no `segmentId`, `SetColor`/`SetEffect`/`SetPalette` target the currently *selected*
65+
segments (the WLED `"seg":{…}` object form); pass a `segmentId` to target one segment.
66+
6167
### Reading data
6268

6369
```csharp
@@ -76,6 +82,7 @@ Build a sparse update that only sends the fields you set:
7682
await client.UpdateState(update => update
7783
.TurnOn()
7884
.Brightness(128)
85+
.Transition(TimeSpan.FromSeconds(2)) // crossfade, up to ~109 minutes
7986
.Segment(0, segment => segment
8087
.Effect(0)
8188
.Color(RgbColor.FromHex("0066FF"))

samples/BasicConsole/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
await client.TurnOn();
99
await client.SetBrightness(200);
10-
await client.SetColor(RgbColor.FromHex("FFAA00")); // warm orange
10+
await client.SetColor(RgbColor.FromHex("FFAA00")); // warm orange, selected segments
1111
await client.SetEffect(9); // "Rainbow"
12-
await client.SetPalette(11); // "Rainbow"
12+
await client.SetPalette(Selector.RandomInRange(5, 10)); // random palette in a range
1313

1414
// --- Reading state ---------------------------------------------------------
1515

@@ -24,6 +24,7 @@
2424
await client.UpdateState(update => update
2525
.TurnOn()
2626
.Brightness(128)
27+
.Transition(TimeSpan.FromSeconds(2))
2728
.Segment(0, segment => segment
2829
.Effect(0)
2930
.Color(RgbColor.FromHex("0066FF"))));

0 commit comments

Comments
 (0)