Coder Social home page Coder Social logo

lifx's Introduction

LIFX + AWS IoT Button Build Status

Control your LIFX bulbs from the command line or AWS Iot Button.

Set up

  1. Set your LIFX Access token as an environment variable: echo "export LifxAccessToken=0000ffff0000ffff0000ffff0000ffff0000ffff" >> ~/.bash_profile
  2. Run npm install
  3. Run npm link

Commands

๐Ÿ’ก You can find the ID (also known as a selector) for a specific bulb using the LIFX List Lights API. You can also use the lifx-get function in this repo.

Toggle light(s)

Toggles the light(s) power.

lifx-toggle --bulb=<bulb ID|all>

Example:

lifx-toggle --bulb=100010000001

This function invokes the toggleIt function in index.js.

Set light(s)

Sets the light(s) parameters to change it's current state.

lifx-set --bulb=<bulb ID|all> --color=<string> --power=<on|off> --brightness=<number> --duration=<number>

Example:

lifx-set --bulb=100010000001 --color=red --power=on --duration=1

This function invokes the setIt function in index.js.

Get light(s)

Gets the current states of the lights(s).

lifx-get --bulb=<bulb ID|all>

Example:

lifx-toggle --bulb=100010000001

This function invokes the getIt function in index.js.

AWS IoT

lifx --bulb=<bulb ID|all> --click=<SINGLE|DOUBLE|LONG>

This function invokes the handler function in index.js. You can edit this function to decide which functions are triggered by different clicks of your IoT button or change the settings in iot-settings.json.

Deploy the code to AWS

  1. Create a CloudFormation template - Follow the AWS IoT Button AWS CloudFormation Quickstart developer guide to create a CloudFormation template. Add an additional role and function to trigger the handler function in index.js (see lifx.template.json for an example).
  2. S3 - Compress this folder and upload it to S3 in the directory specified in your CloudFormation template.
  3. CloudFormation - Create a new stack, upload your template, and enter all environment variables.
  4. Click your button - Click your AWS IoT button to see your lights change. From Lambda in the AWS Console, you can access logs to check for any errors.

lifx's People

Contributors

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