Skip to content
bpohvoodoo edited this page Feb 2, 2020 · 6 revisions

Generic

[GET] /status HTTP/1.0

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

Response

{
  "segment": 1,
  "start": 72,
  "stop": 143,
  "mode": 1,
  "fx_mode": 24,
  "speed": 253,
  "brightness": 46,
  "color": [
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ],
  "ws_fxopt": 176,
  "hostname": "McLightingRGBW",
  "mqtt_host": "192.168.xxx.xxx",
  "mqtt_port": 1883,
  "mqtt_user": "mqtt_user",
  "mqtt_pass": "mqtt-passw0rd",
  "ws_seg": 2,
  "ws_cnt": 144,
  "ws_rgbo": "GRBW",
  "ws_pin": 3,
  "ws_trans": true
}

[GET] /esp_status HTTP/1.0

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

Response

{
  "HOSTNAME":"McLightingRGBW",
  "version": "3.1.0.BETA6",
  "heap": 19696,
  "sketch_size": 619840,
  "free_sketch_space": 1474560,
  "flash_chip_size": 4194304,
  "flash_chip_real_size": 4194304,
  "flash_chip_speed": 40000000,
  "sdk_version": "2.2.2-dev(38a443e)",
  "core_version": "2_6_2",
  "cpu_freq": 160,
  "chip_id": 1458280,
  "animation_lib": "WS2812FX_DMA",
  "ws2812_pin": 3,
  "led_count": 144,
  "rgb_order": "GRBW",
  "rgbw_mode": "ON",
  "button_mode": "OFF",
  "button_gy33": "OFF",
  "ir_remote": "ON",
  "tsop_ir_pin": 13,
  "mqtt": "AMQTT",
  "home_assistant": "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] /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] /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 RGB HEX value.

Response

Warning! This request returns a simple plain text answer!

Value as hex WITHOUT the leading '#' for RGB values only, e.g. 00FFFF.
This is for compatiblity issues with other projects, which do not suppport WRGB.

[GET] /get_color1 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

Toggles all leds immedately off/on.

Response

Warning! This request returns a simple plain text answer!

Value as TEXT 'OK' or 'NOK'

[GET] /on HTTP/1.0

Turns all leds immedately on with last state.

Response

Warning! This request returns a simple plain text answer!

Value as TEXT 'OK' or 'NOK'

[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_trans:     0 (0: switches transition effects off 1: on)

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_trans":"false"
}

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

Returns the list of available animation modes as JSON.

Response

[
  {
    "mode":"off",
    "name":"OFF"
  },
  {
    "mode": 0,
    "name": "Static"
  },
  {
    "mode": 1,
    "name": "Blink"
  },
  {
    "mode": 2,
    "name": "Breath"
  },
  { 
    "mode": "...",
    "name": "..."
  }
]

[GET] /set 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)