项目作者: boneskull

项目描述 :
Interface for Flux (aka "Magic Home") WiFi RGB light bulbs
高级语言: JavaScript
项目地址: git://github.com/boneskull/deadlights.git
创建时间: 2016-12-28T09:58:05Z
项目社区:https://github.com/boneskull/deadlights

开源协议:MIT License

下载


deadlights

Build Status Dependency Status

Interface for Flux (aka “Magic Home”) WiFi RGB light bulbs

This wouldn’t be possible without the Python flux_led project.

My ultimate goal here is to create a Node-RED flow for Flux WiFi bulb control; see node-red-contrib-fluxwifi.

Installation

  1. $ npm install deadlights

Requirements

  • Node.js, probably 4.x or newer

Usage

API is not yet fully implemented!

API docs forthcoming, but an example:

  1. const {discover} = require('deadlights');
  2. // find all the bulbs on the local network
  3. discover()
  4. // grab the first one
  5. .then(bulbs => bulbs.pop())
  6. .then(bulb => {
  7. // toggle the bulb on and off
  8. if (bulb.isOn) {
  9. return bulb.switchOff();
  10. } else {
  11. return bulb.switchOn();
  12. }
  13. })
  14. .then(bulb => {
  15. // close the connection to the bulb;
  16. // without this, the connection (and script) would stay open indefinitely
  17. return bulb.forget();
  18. });

License

:copyright: 2017 Christopher Hiller. Licensed MIT.