Updated JSON API (markdown)

master
Aircoookie 2019-03-27 10:04:41 +01:00
rodzic 6f6b69c49b
commit 54594309cb
1 zmienionych plików z 19 dodań i 1 usunięć

@ -109,9 +109,27 @@ Sample JSON API response (v0.8.4):
| JSON key | Value range | Description
| --- | --- | --- |
on | bool | Is the light on?
on | bool | On/Off state of the light
bri | 0 to 255 | Brightness of the light. If _on_ is `false`, contains last brightness when light was on (aka brightness when _on_ is set to true). Setting _bri_ to 0 is supported but deprecated, it is recommended to use the range 1-255. The state response will never have the value `0` for _bri_.
transition | 0 to 255 | Duration of the crossfade between different colors/brightness levels. One unit is 100ms, so a value of `4` results in a transition of 400ms.
ps | -1 to 65535 | ID of currently set preset. 0.8.4 will always return `-1`.
pl | -1 to 0 | ID of currently set playlist. In 0.8.4 only, this sets the preset cycle feature, `-1` is off and `0` is on.
nl.on | bool | Nightlight currently active
nl.dur | 1 to 255 | Duration of nightlight in minutes
nl.fade | bool | If `true`, the light will gradually dim over the course of the nightlight duration. If `false`, it will instantly turn to the target brightness once the duration has elapsed.
nl.tbri | 0 to 255 | Target brightness of nightlight feature
udpn.send | bool | Send WLED broadcast (UDP sync) packet on state change
udpn.recv | bool | Receive broadcast packets
udpn.nn | bool | Don't send a broadcast packet (applies to just the current API call). Not included in state response.
seg | Array of segment objects | Segments are individual parts of the LED strip. In 0.9.0 this will enable running different effects on different parts of the strip.
#### Contents of the segment object
Notice: _start_, _stop_, and _len_ are not settable in 0.8.4. Any segment with _id_ > 0 is ignored.
| JSON key | Value range | Description
| --- | --- | --- |
id | 0 to info.maxseg-1 | Zero-indexed ID of the segment. May be omitted, in that case the ID will be inferred from the order of the segment objects in the _seg_ array. As such, not included in state response.
start | 0 to info.leds.count-1 | LED the segment starts at.
stop | 0 to info.leds.count | LED the segments stops at, not included in range. If _stop_ is set to a lower or equal value than _start_ (setting to `0` is recommended), the segment is invalidated and deleted.
len | 0 to info.leds.count | Length of the segment (_stop_ - _start_). _stop_ has preference, so if it is included, _len_ is ignored.