From a4fe57d4a1483590f55109731104f9ba8459a857 Mon Sep 17 00:00:00 2001 From: Aircoookie Date: Wed, 18 Dec 2019 12:43:25 +0100 Subject: [PATCH] Updated JSON API (markdown) --- JSON-API.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/JSON-API.md b/JSON-API.md index df11105..1778d0a 100644 --- a/JSON-API.md +++ b/JSON-API.md @@ -15,8 +15,6 @@ You may also obtain those objects individually using the URLs `/json/state` `/js Sending a POST request to `/json` or `/json/state` with (parts of) the state object will update the respective values. Example: `{"on":true,"bri":255}` sets the brightness to maximum. `{"seg":[{"col":[[0,255,200]]}]}` sets the color of the first segment to teal. -Note: In 0.8.4, segments are not supported and any but the first will be ignored. - Sample JSON API response (v0.8.4): ```json @@ -110,8 +108,10 @@ Sample JSON API response (v0.8.4): 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. +tt | 0 to 255 | Similar to transition, but applies to just the current API call. Not included in state response. +ps | -1 to 65535 | ID of currently set preset. +psave | 1 to 16 | Save current light config to specified preset slot. Not included in state response. +pl | -1 to 0 | ID of currently set playlist. For now, 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. @@ -121,7 +121,8 @@ 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. v | bool | If set to _true_ in a JSON POST command, the response will contain the full JSON state object. Not included in state response. time | uint32 | Set module time to unix timestamp. 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. +mainseg | 0 to info.leds.maxseg-1 | Main Segment | Sets which segment ID is the main segment +seg | Array of segment objects | Segments are individual parts of the LED strip. In 0.9.0 this will enables running different effects on different parts of the strip. #### Contents of the segment object @@ -163,6 +164,9 @@ udpport | uint16 | The UDP port for realtime packets and WLED broadcast. live | bool | If `true`, the software is currently receiving realtime data via UDP or E1.31. fxcount | byte | Number of effects included. palcount | uint16 | Number of palettes configured. +wifi.bssid | string | The BSSID of the currently connected network. +wifi.signal | 0 to 100 | Relative signal quality of the current connection. +wifi.channel | 1 to 14 | The current WiFi channel. arch | string | Name of the platform. core | string | Version of the underlying (Arduino core) SDK. freeheap | uint32 | Bytes of heap memory (RAM) currently available. Problematic if <`10k`.