Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

WebSocket API

Malik Mann edited this page Jan 25, 2019 · 8 revisions

WebSocket connection

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

Payload: #<hexrgb>

Set default color of the lamp.

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

Result: OK


Payload: *<hexrgb>

Set default color of the lamp and light all LEDs in that color.

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

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 hex value, e.g. 04d2ff.

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 hex value, e.g. 04d2ff.

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 <hexrgb> is the color as a hex value, e.g. 04d2ff.

This command can be daisy chained!

Example: R0009ffffffR1019ff0000 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 mode.

Where <lightmode> is one of the following:

  • off (Turn all LEDs off.)
  • 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.)

Result: OK


Payload: ~

Only available in version 2.0 and later

Gets the list of avilable animation modes as JSON.

Result:

[
  {
    "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 "~"

Result: OK


Payload: $

Get status info as JSON.

Result:

{
  "mode":0,
  "delay_ms":50,
  "brightness":255,
  "color":[255, 20, 147]
}