Skip to content
bpohvoodoo edited this page Sep 27, 2019 · 1 revision

Generic

[GET] /status HTTP/1.0

This returns a JSON containing the current mode, delay, brightness and color.

Response

{
  "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]
}

[GET] /esp_status HTTP/1.0

This returns a JSON containing the current status of the ESP8266 with following stats:

Response

{
  "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"
}

[GET] /restart HTTP/1.0

Through this API endpoint you can resart your ESP.

Response

Warning! This request returns a simple plain text answer!

restarting...

[GET] /reset_wlan HTTP/1.0

Resets WLAN settings and restarts the ESP8266.

Response

Warning! This request returns a simple plain text answer!

Restarting into captive portal...

[GET] /start_config_ap HTTP/1.0

Start the config AP.

Response

Warning! This request returns a simple plain text answer!

Starting config AP ...

Light control

[GET] /set_brightness HTTP/1.0

Sets the brightness to the given value.

Parameters

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)

Response

This returns the full [GET] /status JSON

[GET] /get_brightness HTTP/1.0

Returns the brightness value.

Response

Warning! This request returns a simple plain text answer!

A value from 0 to 100.

[GET] /set_speed HTTP/1.0

Sets the effect speed to the given value.

Parameters

d: Value from 0 (max slow) to 255 (full speed)

Response

This returns the full [GET] /status JSON

[GET] /get_speed HTTP/1.0

Gets the effect speed as value.

Response

Warning! This request returns a simple plain text answer!

A value from 0 to 255

[GET] /get_switch HTTP/1.0

Gets the light status (switch on/off) as boolean value.

Response

Warning! This request returns a simple plain text boolean answer!

0 or 1

[GET] /get_color HTTP/1.0

Gets the current strip main-color as WRGB HEX value.

Response

Warning! This request returns a simple plain text answer!

Value as hex WITHOUT the leading '#' , e.g. 0000FFFF.

[GET] /get_color2 HTTP/1.0

Gets the current strip background-color as WRGB HEX value.

Response

Warning! This request returns a simple plain text answer!

Value as hex WITHOUT the leading '#' , e.g. 0000FFFF.

[GET] /get_color3 HTTP/1.0

Gets the current strip xtra-color as WRGB HEX value.

Response

Warning! This request returns a simple plain text answer!

Value as hex WITHOUT the leading '#' , e.g. 0000FFFF.

[GET] /off HTTP/1.0

Turns all leds immedately off.

Response

This returns the full [GET] /status JSON

[GET] /<lightmode> HTTP/1.0

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.

Parameters

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)

Response

This returns the full [GET] /status JSON

[GET] /config HTTP/1.0

Change LED settings on the fly

Parameters

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>.

Response

{
  "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
}

[GET] /get_modes HTTP/1.0 (Version >= 2.0)

Returns the list of available animation modes as JSON.

Response

[
  {
    "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": "..."
  }
]

[GET] /all HTTP/1.0

Activates the given animation mode and other parameters

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)

Response

This returns the full [GET] /status JSON

[GET] /set_mode HTTP/1.0

Activates the given animation mode

Parameters

m: Animation ID (see /get_modes for a list of all IDs)

Response

This returns the full [GET] /status JSON

SPIFFS webserver

[GET] /list HTTP/1.0

Lists all files in a directory in a SPIFFS filesystem.

Parameter:

dir: Directory (e.g. /)

Response

[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.

[GET] /format_spiffs HTTP/1.0

Formats the SPIFFS filesystem and erases all data.

Warning! This request returns a simple plain text answer!

Response

Formatting SPIFFS...

[PUT] /edit HTTP/1.0

Create new file

Parameter

First parameter: Filename as full path, e.g. /test.htm

Response

(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] /edit HTTP/1.0

Delete file.

Parameter

First parameter: Filename as full path, e.g. /test.htm

Response

[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.

[POST] /edit HTTP/1.0

Upload file.

Parameter

Multipart upload.

Response

[text/plain]
(empty)