Giter Site home page Giter Site logo

bjones256 / flux-led-hub Goto Github PK

View Code? Open in Web Editor NEW

This project forked from computeythings/flux-led-hub

0.0 2.0 0.0 756 KB

Server application for RESTful control of Flux Wifi LED bulbs

License: BSD 3-Clause "New" or "Revised" License

Dockerfile 0.10% JavaScript 99.46% CSS 0.44%

flux-led-hub's Introduction

Flux Wifi LED Hub

A RESTful server application to offload requests to Flux Wifi LED bulbs.

Installation

To install, simply clone the directory, install node modules, and execute the initial 'run' script to generate your API key:

$ git clone https://github.com/computeythings/flux-led-hub.git
$ cd flux-led-hub
$ npm install
$ npm run

Dependencies

Configuration

The config file can be found in the root directory as the config.json file and currently has only 4 options.

  • listen: The ip address your server will listen on. By default it is open on all addresses.
  • port: The port your server will listen on. Default is port 8000
  • lights: a list of IP addresses corresponding to all of the Flux LEDs you wish to control.
  • apikey: API key used to make requests. This will be set automatically on the first run or can be set/reset manually.

Once you have finished with your configuration, you can start the server with npm start and find the controls at http://localhost:8000 by default.

API

To control lights from other devices you must POST requests to http://<your.server.ip>/api/{on,off,toggle} and include the api key in the POST data as "access_token".

For example a quick test to toggle the lights can be accomplished with curl --data "access_token=<yourAPIkey>" http://<your.server.ip>:8000/api/toggle

Testing

Tests are currently all included within the server.js file. To run a test simply run npm test -- <options> with a space deliniated list of tests as the options. Tests listed will be completed with a 3 second delay between each of them.

For example: npm test -- on off will connect with all of the lights listed in the config file, turn them on, wait 3 seconds, then turn them off.

Testing does not require an API key be set and will not set one unless the apikey test is run.

Test Options

  • on: turn all lights on
  • off: turn all lights off
  • toggle: toggle all lights
  • apikey: generate new API Key in config.json file. CAUTION: this will overwrite your existing key.

These options can also be found with the npm test -- help command.

flux-led-hub's People

Contributors

computeythings avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.