hue-hacking-node

Utility to control Philips Hue light bulbs

npm install hue-hacking-node
36 downloads in the last month

hue-hacking-npm: Hue Control Library

hue-hacking is a javascript library designed to control the Philips Hue smart LED bulb system. This version has been modified to be used as a Node module.

For more information on the Philips Hue bulbs and wireless bridge system, visit meethue.com.

Initial concept and startup work inspired by Ross McKillop's post.

Getting Started

Once you've followed the instructions with your Hue starter kit and you have your lamps working through the web interface or smartphone app, it's time to configure your copy of hue.js.

For a full breakdown of what the Philips Hue API/SDK offers, check out the official developer site. Full details about how to register a new 'user' with the wireless bridge can be found at the SDK getting started page.

  1. Generate and save your MD5 hash (any MD5 generator will do). Be sure to save your hash and the passphrase used to generate it in a safe place.

  2. Find the IP address of your Hue wireless bridge. This can be gathered in a number of ways, including the meethue.com control panel, https://www.meethue.com/en-US/user/preferencessmartbridge, by clicking on the "Show me more" link. See screenshot for an example. Alternatively, you can browse to this URL, and use the value displayed in internalipaddress.

  3. To use the Hue library in a web application, make sure to call the

    setConfig({
         ip: <ipAddress>, 
         key: <hash>
    });
    

    function, passing in the IP address and the API key value generated and registered with the hub.

  4. Optional: If you have more than 3 bulbs (the number included in the Hue starter kit), call the setNumberOfLamps() function, passing in the total number of lamps available, prior to using the lamp control functions.

Included Files

lib/hue-colors.js

Provides convenience functions to convert between CSS-style hex color values, their corresponding RGB color values, and the CIE 1931 X,Y color coordinates supported by the Hue lamp system.

lib/hue-css-colors.js

Provides a map of CSS named colors and their corresponding hex color values.

lib/hue-node.js

Provides control functions to control either single lamps, groups of lamps, or all available lamps. Lamps can be toggled (on/off), flashed for a short or long time, and have their color changed.

lib/hue-test-constants.js

Provides some simple properties to match JSON state responses.

tests/**

nodeunit test suites for colors.js and hue.js. Note: Setup detailed above must be completed in the hue.js file to have tests run.

© 2013 Bryan Johnson; Licensed MIT.

npm loves you