Code Monkey home page Code Monkey logo

dash_hue's Introduction

Dash Hue: Control your Hue installation with your Amazon Dash button

This code permits you to use your Amazon Dash button to control a group of light on your Hue installation.

Why using my Amazon Dash button rather a Dimmer Switch or Philips Tap?

Amazon Dash cost $4.99 or free if you order one time with them. But the Dimmer switch cost approximately $25 and the Philips Tap cost $49.99 (60โ‚ฌ in France). The only one inconvenient is the time to turn on/off the light, approximately 8-15 seconds...

Requirements

  • Linux machine (I don't have tested with Windows)
  • Root rights
  • NodeJS
  • Amazon Dash button (Your dash button should not have a configured product)
  • Philips Hue installation

Installation and configuration

First, you need to clone this repo:

git clone https://github.com/Themimitoof/Dash_Hue.git && cd Dash_Hue

And you need to install all dependencies for the code:

npm install

Now, execute this command to help you to find the MAC address of your Dash button(s). Tape on your Dash button(s) and copy the MAC Address(es). Tape Ctrl+C to exit the program.

node index.js searchDash

Enter the MAC address(es) on the index.js file on the dash variable:

// If you have only one Dash button
var dash        = dash_btn(["AA:BB:CC:DD:EE:FF"]);

// If you likely to use multiple Dash buttons for the same group
var dash        = dash_btn(["AA:BB:CC:DD:EE:FF", "CC:A1:D2:F6:30:90", ...]);

At the same time, change the value of hue_host with the IP of your Hue bridge (if you don't know the IP of your bridge, scan your network with Angry IP Scanner or similar tool):

var hue_host    = "192.168.1.1";

Now, push the central button of your bridge and execute this command to create new user on your bridge:

node index.js newUser

And copy the result on the hue_user variable on index.js file:

var hue_user    = "qsDJODSQkKAPOdqsdoaDJQSODJncxwbcw";

Execute this command to get the group ID of the room you desirate control with your Dash button:

node index.js getGroups

Edit index.js file and modify the hue_group variable with the ID of the room you want to control:

var hue_group   = 1;

Execute node index.js, push on your dash button and check if your lights turn on/off. If all works good, tape this command to execute the server in background task:

screen -dmS Dash_Hue node index.js

Commands

Start the server

node index.js

In background with screen:

screen -dmS Dash_Hue node index.js

Find dash buttons

node index.js searchDash

Create new user in Hue bridge

node index.js newUser

Find groups (rooms) in Hue bridge

node index.js getGroups

troubleshoot

  • "The dash button takes sooooooooooo much time to change the light state, why?" It's normal. On pressing the dash button, he enables the Wifi, request an IP to DHCP server and send the request. Unfortunaly, this process take about 8-15 seconds.
  • "Sometimes, the dash button doesn't change the light state, why?" Sometimes (rarely), the server cannot not detect the packets.

License

This code use the MIT License.

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.