Giter Club home page Giter Club logo

lifx-iot-lambda-switch's Introduction

lifx-iot-lambda-switch

Ridiculously unnecessary light switch for a LIFX wifi bulb, using an AWS IoT Button and AWS Lambda

Why did I make this?

That's a great question. I actually made this about two years ago when I thought the hype for serverless architectures had peaked (lol). I wanted to try out something in the IoT space and get more experience with AWS without having to do something actually difficult.

Setup

  1. You'll need to purchase an AWS IoT Button
  2. You'll also need a LIFX lightbulb
  3. Follow the directions on the AWS docs to configure the button
  4. Follow the instructions to connect the button to lambda
  5. Generate an authentication method for the bulb. You can use OATH, but I just generated an API key here since that's way easier
  6. Upload this code to the lambda function from earlier
  7. Set a lambda environment variable called "API_KEY" with your API token
  8. Ta-da! You now have a $20 lightswitch that takes 7-10 seconds to work and is dependant on your wi-fi connection (I never said this was a good idea)

Usage

Once you follow the setup process, every time you press the IoT button, it will toggle all of your lights. That's because I used the "all" endpoint since I only had one light anyway. You can specify groups and more specific IDs as well. Check out the API Docs if you're interested.

Extensions

This script only has a single function regardless of how you press the button, but there's actually 3 possible states: SINGLE, DOUBLE, and LONG. These are received in the "clickType" field of the event. A possible extension would be to trigger different scenes or colors based on what type of click you used.

lifx-iot-lambda-switch's People

Contributors

spencerhance avatar

Stargazers

 avatar

Watchers

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