Git Product home page Git Product logo

homesmarts-python's Introduction

Homesmarts: Cheap Lightswitchs for Phillips Hue Lights

homesmarts is a python program to allow me to use a cheap Amazon Dash button as a lightswitch for my Phillips Hue lights. Rather than spend $60 on an "official" Phillips Hue switch, I decided to buy multiple $5 Amazon Dash buttons and hack them to operate my Hue lights (instead of order things off Amazon). It runs on my Raspberry Pi 3.

Disclaimer

This idea was heavily incluenced from:

  • Ted Benson's original blog on how he hacked Amazon Dash buttons to track baby data
  • The "listen for ARP requests" code was based on Bob Steinbeiser's comment from the above blog

Dependencies

  • rabbitmq-server: Implementation of AMQP
  • pika: Pika Python AMQP Client Library
  • phue: A Phillips Hue python library

Install

To install on a Debian system (I'm running everything on my Raspberry Pi):

  • Install and run rabbitmq-server
  • Clone this repository

Configure and Run

First off, I highly recommend you read Ted Benson's original blog. It's a great read and does a great job giving an overview how everything works together. (Keep in mind, we'll be interacting with Phillips Hue lights instead of tracking baby poops. :)

IMPORTANT: Before running any homesmarts python program for the first time, be sure to press your Phillips Hue bridge button. This allows the phue library to create a Hue username so it can access the Phillips Hue API.

  • Discover MAC address for all Dash buttons. You can run dash-listener, which should log unknown MAC addresses to standard output.
  • Edit your local homesmarts_config.yaml with your own details. Be sure to include:
    • IP address of your Phillips Hue bridge
    • Defaults to use for when toggling your Phillips Hue lights under light-defaults YAML section
    • Add all Amazon Dash buttons to your switches YAML section. Each Amazon Dash button can be associated with a single light (using light_id) or a group of lights (using group_id).
  • Once everything is configured, run: sudo python homesmarts/dash_listener.py

Helpful Links

Here are some links I found to be very helpful when writing and setting up homesmarts:

FAQs

It won't connect to my Phillips Hue bridge

Be sure you have the correct IP address for your bridge in homesmarts_config.yaml. Also be sure you press the Bridge's button before running the program the first time.

It fails with the error "No privileges"

You need to run dash_listener.py with sudo privileges to enable listening for all ARP requests.

Why use a RabbitMQ dependency? It doesn't seem necessary...

It isn't necessary. I wanted to get experience with AMQP / enterprise messaging. Originally I planned on separate executables; one for listening for ARP messages (which requires sudo privileges) and publishes messages to the queue, and one for processing the messages (which could be run without sudo.

However, I later opted to keep everything in a single executable to make my life easier... but I still wanted to keep my AMQP code as a reference.

homesmarts-python's People

Contributors

curtis628 avatar

Watchers

James Cloos 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.