This project currently has issues with the new 2.0 firmware. Updates pending.
This is an unofficial JSON RESTful API service for controlling LIFX devices. This API adds some reliability that the LIFX gem does not include.
gem install lifx-http
sudo gem install lifx-http
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
Run export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future; sudo -E gem install lifx-http
lifx-http
curl http://localhost:56780/lights.json
curl -XPUT http://localhost:56780/lights/all/toggle -d ''
curl -XPUT "http://localhost:56780/lights/all/color?hue=120&saturation=1&brightness=1&duration=2" -d ''
curl -XPUT http://localhost:56780/lights/all/color -H "Content-Type: application/json" -d '{"hue": 120, "saturation": 1, "brightness": 1, "duration":2}'
_method
: curl "http://localhost:56780/lights/all/color?hue=120&saturation=1&brightness=1&duration=2&_method=put"
curl -XPUT "http://localhost:56780/lights/all/color?hue=35&saturation=0.37&brightness=0.65&duration=10m" -d ''
selector
is either:
all
for all lightslabel:[label]
for light with label label
tag:[tag]
for lights with tag tag
[light_id]
for light with id light_id
GET /lights
- Lists all lightsGET /lights/{selector}
- Lists lights matching selector
PUT /lights/{selector}/on
- Turns lights matching selector
onPUT /lights/{selector}/off
- Turns lights matching selector
offPUT /lights/{selector}/toggle
- Toggle lights matching selector
. If any lights in selector
is on, it will turn them offPUT /lights/{selector}/color
- Sets the color for lights matching selector
. Color data can be passed as URL parameters or form parameters (JSON)PUT /lights/{light_id}/label
- Changes the label of light with id light_id
POST /lights/{light_id}/tag
- Adds a tag to the lightDELETE /lights/{light_id}/tag
- Removes a tag from the lightThis API is documented using Swagger.
To view documentation and play with the API, start the API server locally, then visit http://petstore.swagger.wordnik.com/ and put http://localhost:56780/swagger_doc
in the first text box, then hit Explore
.
You should see something like this:
MIT. See LICENSE