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

WebSocket API

Tobias Blum edited this page Nov 25, 2017 · 8 revisions

WebSocket connection

WebSocket server runs at port 81: ws://esp8266_01.local:81/

Payload: #<hexrgb>

Where <hexrgb> is the color as HEX, e.g. 04d2ff

Set default color of the lamp.

Result: OK
Payload: *<hexrgb>

Where <hexrgb> is the color as HEX, e.g. 04d2ff

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

Result: OK
Payload: !<numled><hexrgb>

Where <numled> is the number of the led (starting with 00), e.g. 01.
Where <hexrgb> is the color as HEX, 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 (starting with 00), e.g. 01.
Where <hexrgb> is the color as HEX, e.g. 04d2ff.

Light multiple LEDs in the given colors.

Result: OK
Payload: R[rangstart_led][rangend_led][hexrgb]R[rangstart_led][rangend_led][hexrgb]R[rangstart_led][rangend_led][hexrgb] [...]

Where <rangstart_led> is the start number of the range (numbers starting with 00), e.g. 00.
Where <rangend_led> is the end number of the range (numbers starting with 00), e.g. 09.
Where <hexrgb> is the color as HEX, e.g. 04d2ff.

Can be repeated multiple times.
Example: R0009ffffffR1019ff0000 lights the first 10 LEDs white and the next 10 red

Light multiple LED ranges in the given colors.

Result: OK
Payload: ?<delay>

Where <delay> is the delay in ms.

Set delay in ms.

Result: OK
Payload: %<brightness>

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

Set brightness.

Result: OK
Payload: =<lightmode>

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

Set mode.

Result: OK
Payload: ~ (Version >= 2.0)

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> (Version >= 2.0)

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

Set animation mode.

Result: OK
Payload: $

Get status info as JSON.

Result: {"mode":0, "delay_ms":50, "brightness":255, "color":[255, 20, 147]}
Clone this wiki locally