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

WebSocket connection

The WebSocket server runs at ws://ESP_IP_ADDRESS_OR_HOSTNAME:81/

Payload: #<hexrgb>

Set main color of the strip.

Where <hexrgb> is the color as a WRGB hex value, e.g. 0004d2ff.

Result: OK

Payload: ##<hexrgb>

Set background color of the strip.

Where <hexrgb> is the color as a WRGB hex value, e.g. 0004d2ff.

Result: OK

Payload: ###<hexrgb>

Set extra color of the strip.

Where <hexrgb> is the color as a WRGB hex value, e.g. 0004d2ff.

Result: OK

Payload: *<hexrgb>

Set main color of the strip and light all LEDs in that color. This is equal to WS2812FX mode "Static".

Where <hexrgb> is the color as a WRGB hex value, e.g. 0004d2ff.

Result: OK

Payload: !<numled><hexrgb>

Where <numled> is the number of the led (start index is 00), e.g. 04 would be the 5th LED. Where <hexrgb> is the color as a WRGB hex value, e.g. 0004d2ff.

Light single LEDs in the given color.

Result: OK

Payload: +[numled][hexrgb]+[numled][hexrgb]+[numled][hexrgb] [...]

Where <numled> is the number of the led (start index is 00), e.g. 04 would be the 5th LED. Where <hexrgb> is the color as a WRGB hex value, e.g. 0004d2ff.

Light multiple LEDs in the given colors.

Result: OK

Payload: R[r_start][r_end][hexrgb] [...]

Light multiple LED ranges in the given colors.

Where <r_start> is the first index of the range (start index is 00). Where <r_end> is the last index of the range. Where is the color as a WRGB hex value, e.g. 0004d2ff.

This command can be daisy chained!

Example: R000900ffffffR101900ff0000 lights the first 10 LEDs white and the next 10 red Result: OK

Payload: ?<speed>

Set speed.

Where <speed> is the speed from 0 to 255.

Result: OK

Payload: %<brightness>

Set brightness.

Where <brightness> is the brightness as value 0-255.

Result: OK

Payload: =<lightmode>

Set named mode. This is only available, if define ENABLE_LEGACY_ANIMATIONS in definitions.h is set.

Where <lightmode> is one of the following:

  • off (Turn all LEDs off.)
  • auto (Starts autocycling.)
  • tv (Starts TV simulator. This is only available, if define ENABLE_TV in definitions.h is set.)
  • e131 (Starts E1.31 Mode. This is only available, if define ENABLE_E131 in definitions.h is set.)
  • 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.)
  • twinklerandom (Starts twinklerandom effect in the given or previously set color.)
  • theaterchase (Starts theaterchase effect in the given or previously set color.)
  • theaterchaseRainbow (Starts theaterchase effect with changing colors.) Result: OK

Payload: ~

Only available in version 2.0 and later

Gets the list of available animation modes as JSON.

Result:

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

Payload: /<animation_mode_id>

Only available in version 2.0 and later

Set animation mode.

Where <animation_mode_id> is on from the list you get with "~" or

  • off (Turn all LEDs off.)
  • auto (Starts autocycling.)
  • tv (Starts TV simulator. This is only available, if define ENABLE_TV in definitions.h is set.)
  • e131 (Starts E1.31 Mode. This is only available, if define ENABLE_E131 in definitions.h is set.)

Result: OK

Payload: $

Get status info as JSON.

Result:

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

Payload: C

Get config info as JSON.

Result:

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

Payload: Ch<hostname>

Set Hostname.

Where <hostname> is a hostname or IP with a length from 0-64 chars.

Result: Will be same as C

Payload: Cmh<mqtt_hostname>

Set MQTT Server Hostname.

Where <mqtt_hostname> is a hostname or IP with a length from 0-64 chars.

Result: Will be same as C

Payload: Cmp<mqtt_port>

Set MQTT Server Port.

Where <mqtt_port> is an integer from 0-65535.

Result: Will be same as C

Payload: Cmu<mqtt_user>

Set MQTT Server username.

Where <mqtt_user> is a username length from 0-32 chars.

Result: Will be same as C

Payload: Cmw<mqtt_pass>

Set MQTT Server password.

Where <mqtt_pass> is a password length from 0-32 chars.

Result: Will be same as C

Payload: Csc<strip_led_count>

Set the strips led count.

Where <strip_led_count> is an integer between 1-9999.

Result: Will be same as C

Payload: Csp<strip_gpio_pin>

Set the strips ws2812fx options.

It is only available, if USE_WS2812FX_DMA is not defined in definitions.h

Where <strip_gpio_pin> is an integer between 0-99. Allowed values for NodeMCU or Wemos are values from 0-5 and 12-16.

Result: Will be same as C

Payload: Csr<strip_rgborder>

Set the strips led order. Where <strip_rgborder> is any combination of the chars r, g, b and w.

Rules:

Every char is only allowed once,

<strip_rgborder> must contain r, g, b,

and can contain w.

Result: Will be same as C

Payload: Cso<strip_fx_options>

Set the strips ws2812fx options. Where <strip_fx_options> is an integer between 0-255.

See WS2812FX documentation for more infos.

Result: Will be same as C

Clone this wiki locally