cURL-y Hue

Ars Technical has published their review of the Philips Hue, and nestled within it are a few highly relevant paragraphs:

It’s a simple matter to set a lamp’s color and brightness using HTTP. The easiest way to do it is to use the Hue app to get a lamp set exactly the way you want it, then query its status by sending an HTTP GET to http://(your hub's address)/api/(your hash) to see what the settings are. The GET request will return a JSON object showing the bulb’s on or off state, its brightness, its hue, saturation, (sort of) its CIE 1931 color coordinates, its color temperature in mireds, and a few other items. Copy the settings you want to set or change (probably “on,” “bri,” and the color settings), and you now have the basis of a cURL command to set the lamp to that state at any point.

Want to turn a lamp off? Just do cURL -X PUT -d '{"on":false}' http://(your hub's address)/api/(your hash)/lights/(light number)/state, subbing in your hub’s LAN IP address, your hash, and the number of the light you want to turn off. Want the lamp back on? Use the same command, but replace the {"on":false} with {"on":true}. Want to set a light to full brightness? Use {"bri":255} instead. Want to take a light at full brightness and slowly dim it down to half? Use {"bri":127,"transitiontime":100}, which will take the brightness down from 255 to 127 over 10 seconds (the transitiontime parameter is expressed in increments of 100 ms).

All of this means that the Philips Hue does indeed use REST – just like the Light – and, as a consequence, it should be a very straightforward procedure (and only just a tiny bit of code) to get the Light to control a household of Hue bulbs.

It also means that you should be able to use the web apps we’ve posted here (and will continue to post) and modify them slightly to work with Philips Hue bulbs.  Let us know if you do!