1 | # hubot-philipshue
|
2 |
|
3 | This is a Hubot script package that will control your Philips Hue lights.
|
4 |
|
5 | [![Build Status](https://travis-ci.org/kingbin/hubot-philipshue.png)](https://travis-ci.org/kingbin/hubot-philipshue)
|
6 |
|
7 | ## Dependencies
|
8 |
|
9 | - [A Local Hubot Installation](https://github.com/github/hubot/blob/master/docs/README.md "A Local Hubot Installation")
|
10 | - [Philips Hue Lightbulb system](https://www.meethue.com/en-US "Philips Hue Lightbulb system")
|
11 | - I'm using [campfire](https://campfirenow.com/ "campfire") to interact with my system. Other [adapters](https://github.com/github/hubot/blob/master/docs/adapters.md) should work as well.
|
12 |
|
13 | Uses the [`node-hue-api`](https://github.com/peter-murray/node-hue-api "Node Hue API") NPM package to communicate with the hue bridge.
|
14 |
|
15 | ## Installation
|
16 |
|
17 | Run the following command to make sure the module is installed to your local Hubot instance.
|
18 |
|
19 | ```bash
|
20 | $ npm install hubot-philipshue --save
|
21 | ```
|
22 |
|
23 | To enable the script, add the `hubot-philipshue` entry to the `external-scripts.json` file (you may need to create this file).
|
24 |
|
25 | ```json
|
26 | ["hubot-philipshue"]
|
27 | ```
|
28 |
|
29 | ## Configuration
|
30 |
|
31 | ### Environment variables
|
32 |
|
33 | | Variable | Description |
|
34 | | ------------------ | ------------------------------------------ |
|
35 | | `PHILIPS_HUE_HASH` | The generated secret hash described below. |
|
36 | | `PHILIPS_HUE_IP` | The IP address of your Hue Hub. |
|
37 |
|
38 | ```bash
|
39 | export PHILIPS_HUE_HASH="YourSecretHash"
|
40 | export PHILIPS_HUE_IP="xxx.xxx.xxx.xxx"
|
41 | ```
|
42 |
|
43 | ### Getting your Hue Hash
|
44 |
|
45 | There is a two-step process to generating the credentials above.
|
46 |
|
47 | First, press the button on your Hue Hub. This puts the device in a mode to accept new connections.
|
48 |
|
49 | Second, make an HTTP POST request of the JSON payload below to `http://YourHueHub/api`. You can use the [Clip API Debugger](http://www.developers.meethue.com/documentation/getting-started) on your base station as well.
|
50 |
|
51 | ```bash
|
52 | $ curl -v -H "Content-Type: application/json" -X POST 'http://YourHueHub/api' -d '{"devicetype": "YourAppName"}'
|
53 | ```
|
54 |
|
55 | The Hub will respond with:
|
56 |
|
57 | ```json
|
58 | {"success":{"username":"YourSecretHash"}}
|
59 | ```
|
60 |
|
61 | The `username` property will contain the hash key to use in the `PHIPLIPS_HUE_HASH` environment variable.
|
62 |
|
63 | #### Troubleshooting
|
64 |
|
65 | If you have not pressed the button on the Hue Hub you will receive an error like this:
|
66 |
|
67 | ```json
|
68 | {"error":{"type":101,"address":"/","description":"link button not pressed"}}
|
69 | ```
|
70 |
|
71 | Press the link button on the hub and try again.
|
72 |
|
73 | ## Commands:
|
74 | - hubot hue lights - list all lights
|
75 | - hubot hue light {light number} - shows light status
|
76 | - hubot hue hsb light {light number} {hue} {saturation} {brightness}
|
77 | - hue range: 0-6553
|
78 | - saturation range: 0-254
|
79 | - brightness range: 0-254
|
80 | - hubot hue xy light {light number} {x} {y}
|
81 | - x-y values are in the [CIE Color Space](http://developers.meethue.com/coreconcepts.html#color_gets_more_complicated)
|
82 | - valid x: 0.0-1.0
|
83 | - valid y: 0.0-1.0
|
84 | - hubot hue ct light {light number} {color temp}
|
85 | - color temperature values use [Mired color temperature](http://en.wikipedia.org/wiki/Mired)
|
86 | - color temperature range: 153-500 (153 appears 6500K, 500 appears 2000K)
|
87 | - hubot hue turn light {light number} {on|off} - flips the switch
|
88 | - hubot hue groups - lists the groups of lights
|
89 | - hubot hue config - reads bridge config
|
90 | - hubot hue {alert|alerts} light {light number} - blink once or blink for 10 seconds specific light
|
91 | - hubot hue {colors|colorloop|loop} {on|off} light {light number} - enable or disable the colorloop effect
|
92 | - hubot hue group {group name}=[{comma separated list of light indexes}]
|
93 | - hubot hue rm group {group name} - remove grouping of lights named <group name>
|
94 | - hubot hue @<group name> <on|off> - turn all lights in <group name> on or off
|
95 | - hubot hue @{group name} hsb=({hue},{sat},{bri}) - set hsb value for all lights in group
|
96 | - hubot hue @{group name} xy=({x},{y}) - set x, y value for all lights in group
|
97 | - hubot hue @{group name} ct={color temp} - set color temp for all lights in group
|
98 |
|
99 | ## Notes:
|
100 |
|
101 | ## Author:
|
102 | [kingbin](https://github.com/kingbin "kingbin")
|
103 |
|
104 | ## Contributors:
|
105 | [stephenyeargin](https://github.com/stephenyeargin "stephenyeargin")
|
106 |
|
107 | [bschlief](https://github.com/bschlief "bschlief")
|