{"id":17986645,"url":"https://github.com/spencerhance/lifx-iot-lambda-switch","last_synced_at":"2025-08-01T21:08:02.793Z","repository":{"id":96959984,"uuid":"127844032","full_name":"spencerhance/lifx-iot-lambda-switch","owner":"spencerhance","description":"Ridiculously unnecessary light switch for a LIFX wifi bulb, using an AWS IoT Button and AWS Lambda","archived":false,"fork":false,"pushed_at":"2018-04-03T03:48:29.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T02:46:31.635Z","etag":null,"topics":["aws-iot","aws-iot-button","aws-iot-python","aws-lambda","lifx","lifx-api"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spencerhance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-03T03:11:42.000Z","updated_at":"2018-04-03T17:02:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"d995b77b-d8bc-4ce1-bb43-89a62afaa7d6","html_url":"https://github.com/spencerhance/lifx-iot-lambda-switch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/spencerhance/lifx-iot-lambda-switch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spencerhance%2Flifx-iot-lambda-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spencerhance%2Flifx-iot-lambda-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spencerhance%2Flifx-iot-lambda-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spencerhance%2Flifx-iot-lambda-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spencerhance","download_url":"https://codeload.github.com/spencerhance/lifx-iot-lambda-switch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spencerhance%2Flifx-iot-lambda-switch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268297298,"owners_count":24228123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-iot","aws-iot-button","aws-iot-python","aws-lambda","lifx","lifx-api"],"created_at":"2024-10-29T18:42:28.844Z","updated_at":"2025-08-01T21:08:02.736Z","avatar_url":"https://github.com/spencerhance.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lifx-iot-lambda-switch\nRidiculously unnecessary light switch for a LIFX wifi bulb, using an [AWS IoT Button](https://aws.amazon.com/iotbutton/) and [AWS Lambda](https://aws.amazon.com/lambda/)\n\n\n### Why did I make this?\nThat'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.  \n\n### Setup\n1. You'll need to purchase an [AWS IoT Button](https://aws.amazon.com/iotbutton/)\n2. You'll also need a [LIFX lightbulb](https://www.lifx.com/)\n2. Follow the directions on the AWS docs to [configure the button](https://aws.amazon.com/iotbutton/)\n3. Follow the instructions to [connect the button to lambda](https://docs.aws.amazon.com/iot/latest/developerguide/iot-lambda-rule.html)\n4. Generate an authentication method for the bulb.  You can use OATH, but I just generated an API key [here](\nhttps://cloud.lifx.com/settings) since that's way easier\n5. Upload this code to the lambda function from earlier\n6. Set a lambda environment variable called \"API_KEY\" with your API token\n6. 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_)\n\n### Usage\nOnce 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](https://api.developer.lifx.com/docs) if you're interested.\n\n### Extensions\nThis 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspencerhance%2Flifx-iot-lambda-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspencerhance%2Flifx-iot-lambda-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspencerhance%2Flifx-iot-lambda-switch/lists"}