From e42e71524b57429db657b402bf81bfbf45ff8868 Mon Sep 17 00:00:00 2001 From: Aircoookie Date: Sat, 29 Aug 2020 22:17:31 +0200 Subject: [PATCH] Updated JSON API (markdown) --- JSON-API.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/JSON-API.md b/JSON-API.md index d72227d..d1d219b 100644 --- a/JSON-API.md +++ b/JSON-API.md @@ -129,7 +129,7 @@ seg | Array of segment objects | Segments are individual parts of the LED strip. **Notice:** _start_, _stop_, and _len_ are not changeable in 0.8.4. Any segment with _id_ > 0 is ignored. Unless stated otherwise, every value may be changed via an HTTP POST request. -The tertiary color is not gamma-corrected in 0.8.4, but will be in subsequent releases. +The tertiary color is not gamma-corrected in 0.8.4, but is in subsequent releases. | JSON key | Value range | Description | --- | --- | --- | @@ -146,6 +146,8 @@ sel | bool | `true` if the segment is selected. Selected segments will have thei rev | bool | Flips the segment, causing animations to change direction. on | bool | Turns on and off the individual segment. (available since 0.10.0) bri | 0 to 255 | Sets the individual segment brightness (available since 0.10.0) +mi | bool | Mirrors the segment (available since 0.10.2) +i | Array | Individual LED control. Not included in state response (available since 0.10.2) #### Info object @@ -178,3 +180,25 @@ brand | string | The producer/vendor of the light. Always `WLED` for standard in product | string | The product name. Always `DIY light` for standard installations. btype | string | The origin of the build. `src` if a release version is compiled from source, `bin` for an official release image, `dev` for a development build (regardless of src/bin origin) and `exp` for experimental versions. `ogn` if the image is flashed to hardware by the vendor. mac | string | The hexadecimal hardware MAC address of the light, lowercase and without colons. + +#### Per-segment individual LED control + +Using the `i` property of the segment object, you can set the LED colors in the segment using the JSON API. +Keep in mind that this is non-persistent, if the light is turned off the segment will return to effect mode. +The segment is blanked out when using individual control, the set effect will not run. +To disable, change any property of the segment or turn off the light. + +To set individual LEDs starting from the beginning, use an array of Color arrays. +`{"seg":{"i":[[255,0,0], [0,255,0], [0,0,255]]}}` will set the first LED red, the second green and the third blue. + +To set individual LEDs, use the LED index followed by its Color array. +`{"seg":{"i":[0,[255,0,0], 2,[0,255,0], 4,[0,0,255]]}}` is the same as above, but leaves blank spaces between the lit LEDs. + +To set ranges of LEDs, use the LED start and stop index followed by its Color array. +`{"seg":{"i":[0,8,[255,0,0]]}}` sets the first eight LEDs to red. + +Keep in mind that the LED indices are segment-based, so LED 0 is the first LED of the segment, not of the entire strip. +Segment features, including Grouping, Spacing, Mirroring and Reverse are functional. +This feature is available in build 200829 and newer. + +