-
Notifications
You must be signed in to change notification settings - Fork 289
HTTP REST API
This returns a JSON containing the current mode, delay, brightness and color.
{
"mode": 5,
"delay_ms": 50,
"brightness": 128,
"color": [
0,
0,
0
]
}
This returns a JSON containing the current status of the ESP8266 with following stats:
- heap: Free heap memory in bytes.
- analog: Value for A0.
- gpio: All GPIO statuses.
{
"heap": 31384,
"analog": 4,
"gpio": 28677
}
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
{
"mode": 5,
"delay_ms": 50,
"brightness": 128,
"color": [
0,
0,
0
]
}
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
{
"mode": 5,
"delay_ms": 50,
"brightness": 128,
"color": [
0,
0,
0
]
}
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 light color as RGB HEX value.
Warning! This request returns a simple plain text answer!
Value as hex WITHOUT the leading '#' , e.g. 00FFFF.
Turns all leds immedately off.
This returns the full
[GET] /status
JSON
{
"mode": 5,
"delay_ms": 50,
"brightness": 128,
"color": [
0,
0,
0
]
}
Note: Deprecated in v2, use /set_mode instead. Will be removed in future versions.
Sets the lightmode where <lightmode>
is one of the following:
Lightmode | Desciption |
---|---|
all |
Turn all LEDs on in the given or previously set color. |
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. |
theaterchaseRainbow |
Starts theaterchase effect with changing colors. |
tv |
Starts TV simulator. |
Give either the red, green and blue value separate (as an integer ranging from 0 to 255) or give as a single RGB hex value
r: Value for red (0-255)
g: Value for green (0-255)
b: Value for blue (0-255)
d: Value for delay as ms (0-255)
rgb: Value for color as HEX RGB value, e.g. 04d2ff
d: Value for delay as ms (0-255)
This returns the full
[GET] /status
JSON
{
"mode": 5,
"delay_ms": 50,
"brightness": 128,
"color": [
0,
0,
0
]
}
Change LED settings on the fly
ct: Number of pixels (number)
rgbo: RGB Pixel Order (grb/gbr/rgb/rbg/brg/bgr)
pin: GPIO PIN for data line (16/5/4/0/2/14/12/13/15/3/1)
{
"pixel_count": 24,
"rgb_order": 52,
"pin": 14
}
Returns the list of available animation modes as JSON.
[
{
"mode": 0,
"name": "Static"
},
{
"mode": 1,
"name": "Blink"
},
{
"mode": 2,
"name": "Breath"
},
...
]
Activates the given animation mode.
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)
OR
rgb: Value for color as HEX RGB value, e.g. 04d2ff
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
{
"mode": 5,
"delay_ms": 50,
"brightness": 128,
"color": [
0,
0,
0
]
}
Lists all files in a directory in a SPIFFS filesystem.
Parameter:
dir: Directory (e.g. /)
Result: [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.
Create new file
Parameter:
First parameter: Filename as full path, e.g. /test.htm
Result: [text/plain]
(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.
Parameter:
First parameter: Filename as full path, e.g. /test.htm
Result: [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.
Parameter:
Multipart upload.
Result: [text/plain]
(empty)