-
Notifications
You must be signed in to change notification settings - Fork 30
HTTP REST API (V2)
This returns a JSON containing the current mode, delay, brightness and color.
{
"mode":5,
"ws2812fx_mode":0,
"ws2812fx_mode_name":"Static",
"speed":255,
"brightness":43,
"color":[0,255,57,0,0,0,0,0,0,0,0,0]
}
This returns a JSON containing the current status of the ESP8266 with following stats:
{
"HOSTNAME":"McLightingRGBW",
"version":"2.2.3.rgbw.3c",
"heap":9336,
"sketch_size":533776,
"free_sketch_space":1560576,
"flash_chip_size":4194304,
"flash_chip_real_size":4194304,
"flash_chip_speed":40000000,
"sdk_version":"3.0.0-dev(c0f7b44)",
"core_version":"2_5_0",
"cpu_freq":160,
"chip_id":1458415,
"animation_lib":"WS2812FX_DMA",
"ws2812_pin":3,
"led_count":194,
"rgb_order":"GRBW",
"rgbw_mode":"ON",
"button_mode":"ON",
"button_pin":14,
"button_gy33":"ON",
"gy33_pin":12,
"ir_remote":"ON",
"tsop_ir_pin":13,
"mqtt":"AMQTT",
"home_assistant":"ON",
"legacy_animations":"ON",
"tv_animation":"ON",
"e131_animations":"ON",
"ota":"HTTP",
"state_save":"SPIFFS"
}
Through this API endpoint you can resart your ESP.
Warning! This request returns a simple plain text answer!
restarting...
Resets WLAN settings and restarts the ESP8266.
Warning! This request returns a simple plain text answer!
Restarting into captive portal...
Start the config AP.
Warning! This request returns a simple plain text answer!
Starting config AP ...
Sets the brightness to the given value.
Only use one of the two possible parameters!
p: Value from 0 (off) to 255 (full brightness)
c: Value from 0 (off) to 100 (full brightness)
This returns the full [GET] /status JSON
Returns the brightness value.
Warning! This request returns a simple plain text answer!
A value from 0 to 100.
Sets the effect speed to the given value.
d: Value from 0 (max slow) to 255 (full speed)
This returns the full [GET] /status JSON
Gets the effect speed as value.
Warning! This request returns a simple plain text answer!
A value from 0 to 255
Gets the light status (switch on/off) as boolean value.
Warning! This request returns a simple plain text boolean answer!
0 or 1
Gets the current strip main-color as WRGB HEX value.
Warning! This request returns a simple plain text answer!
Value as hex WITHOUT the leading '#' , e.g. 0000FFFF.
Gets the current strip background-color as WRGB HEX value.
Warning! This request returns a simple plain text answer!
Value as hex WITHOUT the leading '#' , e.g. 0000FFFF.
Gets the current strip xtra-color as WRGB HEX value.
Warning! This request returns a simple plain text answer!
Value as hex WITHOUT the leading '#' , e.g. 0000FFFF.
Turns all leds immedately off.
This returns the full [GET] /status JSON
Note: Deprecated in v2, use /set_mode instead. Will be removed in future versions.
Sets the lightmode where is one of the following:
Lightmode | Desciption |
---|---|
auto | Starts autocycling. |
tv | Starts TV simulator, if defined ENABLE_TV. |
e131 | Starts E1.31 mode, if defined ENABLE_E131 |
all | Turn all LEDs on in the given or previously set color. |
the folowing only, if defined ENABALE_LEGACY_ANIMATIONS. | |
wipe | Turn all LEDs on in the given or previously set color, with wipe effect. |
rainbow | Starts rainbow effect. |
rainbowcycle | Starts rainbow cycle effect. |
theaterchase | Starts theaterchase effect in the given or previously set color. |
twinklerandom | Starts twinklerandom effect with changing colors. |
theaterchaserainbow | Starts theaterchase effect with changing colors. |
Give either the red, green, blue and white value separate (as an integer ranging from 0 to 255) or give as a single WRGB hex value
r: Value for red (0-255)
g: Value for green (0-255)
b: Value for blue (0-255)
w: Value for blue (0-255)
r2: Value for red (0-255)
g2: Value for green (0-255)
b2: Value for blue (0-255)
w2: Value for blue (0-255)
r3: Value for red (0-255)
g3: Value for green (0-255)
b3: Value for blue (0-255)
w3: Value for blue (0-255)
rgb: Value for color as HEX WRGB value, e.g. 0004d2ff
rgb2: Value for color as HEX WRGB value, e.g. 0004d2ff
rgb3: Value for color as HEX WRGB value, e.g. 0004d2ff
c: Value for brightness (0-100)
OR
p: Value for brightness (0-255)
s: Value for speed (0-255)
This returns the full [GET] /status JSON
Change LED settings on the fly
hostname: McLightingRGBW (max. 64 chars)
mqtt_host: 192.168.0.10 (max. 64 chars)
mqtt_port: 1883 (0-65535)
mqtt_user: mqtt_user (max. 32 chars)
mqtt_pass: mqtt-passw0rd (max. 32 chars)
ws_cnt: 194 (1-9999 Number of pixels.
ws_rgbo: GRBW (RGB Pixel Order: Any combination of the chars r, g, b and w.
Every char is only allowed once, <ws_rgbo>
must contain r, g, b, and can contain w.)
ws_pin: 3 (0-99. GPIO PIN for data line. Valid are 16/5/4/0/2/14/12/13/15/3/1)
ws_fxopt: 48 (0-255).
See WS2812FX documentation for more infos. regarding how to use <ws_fxopt>
.
{
"hostname":"McLightingRGBW",
"mqtt_host":"192.168.0.10",
"mqtt_port":1883,
"mqtt_user":"mqtt_user",
"mqtt_pass":"mqtt-passw0rd",
"ws_cnt":194,
"ws_rgbo":"GRBW",
"ws_pin":3,
"ws_fxopt":48
}
Returns the list of available animation modes as JSON.
[
{
"mode":"off",
"name":"OFF"
},
{
"mode":"tv",
"name":"TV"
},
{
"mode":"e131",
"name":"E131"
},
{
"mode":"custom",
"name":"CUSTOM WS"
},
{
"mode": 0,
"name": "Static"
},
{
"mode": 1,
"name": "Blink"
},
{
"mode": 2,
"name": "Breath"
},
{
"mode": "...",
"name": "..."
}
]
Activates the given animation mode and other parameters
m: Animation ID (see /get_modes for a list of all IDs)
r: Value for red (0-255)
g: Value for green (0-255)
b: Value for blue (0-255)
w: Value for blue (0-255)
r2: Value for red (0-255)
g2: Value for green (0-255)
b2: Value for blue (0-255)
w2: Value for blue (0-255)
r3: Value for red (0-255)
g3: Value for green (0-255)
b3: Value for blue (0-255)
w3: Value for blue (0-255)
rgb: Value for color as HEX WRGB value, e.g. 0004d2ff
rgb2: Value for color as HEX WRGB value, e.g. 0004d2ff
rgb3: Value for color as HEX WRGB value, e.g. 0004d2ff
c: Value for brightness (0-100)
OR
p: Value for brightness (0-255)
s: Value for speed (0-255)
This returns the full [GET] /status JSON
Activates the given animation mode
m: Animation ID (see /get_modes for a list of all IDs)
This returns the full [GET] /status JSON
Lists all files in a directory in a SPIFFS filesystem.
dir: Directory (e.g. /)
[application/json]
[
{
"type": "file",
"name": "edit.htm.gz"
},
{
"type": "file",
"name": "graphs.js.gz"
},
{
"type": "file",
"name": "favicon.ico"
},
{
"type": "file",
"name": "index.htm"
}
]
Error:
[500] BAD ARGS (text/plain): No parameter given.
Formats the SPIFFS filesystem and erases all data.
Warning! This request returns a simple plain text answer!
Formatting SPIFFS...
Create new file
First parameter: Filename as full path, e.g. /test.htm
(empty)
Error:
[500] BAD ARGS (text/plain): No parameter given.
[500] BAD PATH (text/plain): Path not valid.
[500] FILE EXISTS (text/plain): File already exists.
[500] CREATE FAILED (text/plain): File creation error.
Delete file.
First parameter: Filename as full path, e.g. /test.htm
[text/plain]
(empty)
Error:
[500] BAD ARGS (text/plain): No parameter given.
[500] BAD PATH (text/plain): Path not valid.
[404] FileNotFound (text/plain): File not found.
Upload file.
Multipart upload.
[text/plain]
(empty)