Skip to content

ra100/lifx-rest-web

Repository files navigation

LIFX Web Control

Web interface for LAN control of LIFX bulbs with REST API

Build Setup

# install dependencies
$ npm install # Or yarn install

# serve with hot reload at localhost:3000
$ npm run dev

# build for production and launch server
$ npm run build
$ npm start

# generate static project
$ npm run generate

For detailed explanation on how things work, checkout the Nuxt.js docs.

API

All endpoints are prefixed by /api/v1

GET /lights

Gets list of lights

[
  {
    "id": "d073d545688f",
    "address": "192.168.150.101",
    "label": "Awesome 1",
    "status": "on"
  },
  {
    "id": "d123d123456b",
    "address": "192.168.150.102",
    "label": "Awesome 2",
    "status": "on"
  }
]

GET /lights/:identifier

As identifier you can use label, id or IP address.

Gets info about single light

{
  "id": "d073d545688f",
  "address": "192.168.150.101",
  "label": "Awesome 1",
  "status": "on"
}

GET /lights/:identifier/state

Show state of one light, with colors, power,...

{
  "id": "d123d123456b",
  "address": "192.168.150.102",
  "label": "Awesome 2",
  "status": "on",
  "color": {
    "hue": 268,
    "saturation": 0,
    "brightness": 100,
    "kelvin": 3200
  },
  "power": 0
}

PATCH /lights/:identifier

Send in payload what you want to change, duration can be omitted:

{
  "power": 1,
  "duration": 4000
}
{
  "brightness": 50,
  "hue": 0,
  "saturation": 0,
  "kelvin": 3000,
  "duration": 0
}
{
  "brightness": 50
}

for value ranges see node-lifx

GET /metrics

Returns status of all lights, default in prometheus.io format. If Accept header is set to application/json then stats are returned as JSON array.

About

LIFX control from web through REST API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published