Friday, November 23, 2012

In living color: Ars reviews the hacker-approved Philips Hue LEDs

Philips LED-powered Hue lights are awesome. Even after a couple of weeks of almost non-stop fiddling, the programmable multicolored bulbs continue to surprise me, though probably not in the ways that Philips originally intended. It's taken an alarmingly short amount of time for me to grow to consider them an indispensable component of my home office. I'm even starting to incorporate them around the rest of the house too. Being able to control the color, brightness, and timing of your lights from your phone or computer—and tying the lights together with your own on/off schedule—is addictive.

The kit

The fancy wirelessly controlled devices launched just before Halloween this year and are currently sold only at Apple Stores. They're available as both individual bulbs and in a three-bulb starter kit. The starter kit also contains the wireless bridge you need in order to actually use the lights as anything other than plain old on-off lights. The starter kit retails for an unfortunately steep $199.95; the individual lights are $59.99 apiece.

Enlarge / The front of the Hue box, with its wheel. OMG IT SPINS.

The starter kit, pictured above, features a picture of a Hue bulb on the front backed by a color wheel, which you can slide around to make the bulb change colors. It's a neat way to show the functionality of what's inside.

Enlarge / This is what's in the box: three Hue bulbs, a bridge, an AC adapter, and a length of cat 5 cable.

Inside the starter kit are three Hue bulbs, the wireless bridge that runs them, an AC power adapter, and a short length of cat 5 cable for connecting the bridge to a network switch. The bulbs themselves have US-standard E26 screw fittings. They draw 8.5 watts each at peak power, putting out 600 lumens (roughly the same amount of light as a 50-watt incandescent bulb). They're rated for 15,000 hours of continuous use, which at eight hours a day should get you upwards of five years of fun colors.

The lights are wirelessly controlled by a central bridge using Zigbee Light Link, and the starter kit's lights are preconfigured to work automatically with the included bridge. A single bridge can control up to fifty bulbs. Reprogramming the starter kit lights to work with another bridge is difficult and requires some extra hardware. Philips clearly wants you to purchase a starter kit and then expand your Hue collection by buying individual bulbs rather than multiple starter kits.

Enlarge / The Hue bridge, with all status lights on. The central ring illuminates the button used for linking the hub to the Hue app or other things.

The hookup

Setting up the kit was easy. The included instructions are minimal: plug the bridge in to power and network, screw in your lights and turn them on, then download and install the iOS or Android Hue app to your smartphone or tablet. The Hue app links with the bridge over your LAN. You are then able to transform your room into a soothing tone-appropriate workspace, an artfully lit scene echoing the colors of a cherished photograph, or a nightmare clown funhouse.

The app only works via Wi-Fi with your LAN by default. If you want to use it to control your lights while you're away, you'll need to link your Hue system to Philips Web portal. This is quickly done via the Web portal itself, and thereafter the app will function from anywhere.

The app

Philips clearly took a non-geek approach to the app—rather than immediately exposing a color wheel and other controls, the app on launch presents a set of "scenes." These are pictures provided by Philips (you can add your own pictures as well, or snap some with your phone's camera). The scenes provided by Philips are all colorful, and when you tap each of them, your Hue lights shift to display colors from that scene. This is the primary way you'll be interacting with the app—scenes are preset color bookmarks for some or all of your lights. The ones Philips includes in the app give you a broad range of different colors to choose from. You can also customize them or create your own.

Picking colors for your individual Hue lights from a scene.

The lights are assigned colors from the scene. When editing a scene, each light is represented by a drop-pin with that light's number on it. As you move each light's drop-pin around the image, the color of that point in the image is faithfully reproduced by the bulb. The color fidelity is good across most of the spectrum—browns are difficult to do, and greens aren't as deep as I'd like, but blues and reds are eye-wateringly rich.

A sampling of some of the colors the Hue bulbs can produce.

Philips claims the idea behind letting you use photographs to determine the bulbs' colors rather than just giving you a bare color wheel is to let you tie in your room lighting with memories of your favorite photographs. Did you have an amazing outdoor sunset wedding? Stick a picture of it into the app and your Hue lights will glow with orange-gold sunset tones and the dark blue of the evening sky. Got pictures of yourself hanging from that one amazing pitch you climbed at E-Rock last summer? Your Hue lights can pick out the greens and grays and blues and try to recreate the mood.

The default page of the Hue app, showing some of the scenes which can be used to color the Hue lights. The app comes preconfigured with two pages of scenes.

In addition to the photograph-based scenes, there are also four "recipes" in the app's scene list. Rather than being based on photos, the "recipes" are specific hues of light which Philips says will complement or enhance specific states of mind. The "Relax" recipe bathes the room in dim golds, and "Concentrate" produces clear, almost sunlight-hued light. "Energize" sends the room into stark white with a hint of blue, and "Reading" looks a lot like standard yellow incandescent light. Philips has some pseudoscientific justification about how each setting alters your brain patterns or some such, but the recipes serve a far more important function: they are the only way to single-tap your lights into a uniform uncolored state. All of the other pre-made scenes involve some amount of non-neutral colors.

Fortunately, you aren't limited to using scenes to customize your lights—more granular controls are available. At the bottom of the scene selection page is a drag handle, which you can slide upward to reveal a screen full of sliders with which you can control each light's intensity.

Controlling the individual bulbs' brightness levels.

Tilting the phone to the side changes the sliders into a color selection screen, where you can move each light's drop-pin to tweak its shade. The left half of the screen is given over to standard lighting hues, with a color temperature range between 2000-6500K. The right half of the screen contains the whole spectrum of colors the lights can produce. Dragging one light's drop-pin onto another's temporarily groups the lights together so they display the same color and can be adjusted in lock-step.

Enlarge / Customizing the color of each bulb.

You can create your own scenes, using photos you provide or pulling from Philips library; the Hue portal also lets you grab scenes created by others. You can make scenes based on the four built-in recipes as well. When setting up a scene, you're able to choose which lights the scene affects (which is how you can separately control different Hue bulbs in different rooms), the lights' intensity, and their colors.

Left: Creating a new scene: do you start with a photo of your own choosing, a picture from Philips, or a pre-built "recipe"? Right: The built-in "recipes" are supposedly tuned to enhance certain moods or mental states. They're neat, but they did not help me finish this review any faster.
Left: Step two is picking which lights your new scene will use. Limiting certain scenes to certain lights is the easiest way within the app to group the lights together, and this is how you use the app to control lights in different rooms separately. Right: The last step is using the picture you selected (in this case, I picked the full spectrum pic provided by Philips) to set your lights' colors.

You can also add a timer to each scene, which adds some neat wrinkles to how the lights can be used. You can set your custom scene to automatically activate at a certain time, either coming on immediately or fading in over a 3- or 9-minute period. A scene could easily be constructed to flip the house lights on before you arrive home from work, or to gently fade in and wake you up in the morning.

At least, that's the theory—the scheduling utility is crippled into worthlessness by not being able to set a separate schedule for weekdays versus weekends. It's all well and good to be able to have my bedroom slowly fill with warm light at 6:00 a.m. on a weekday, but I sure as hell don't want that happening on Saturday morning.

Philips, though, has gone the unusual route of not locking down the Hue's bridge. Though there is no official SDK available yet—Philips promises one is coming soon—the bridge which controls the system is actually quite receptive to hacking (the good kind of hacking, not the bad kind). This opens up a world of awesome possibilities we'll get into in just a moment.

On the Web

The Web portal lets you add additional scenes to your library from the Hue community or upload your own scenes for others to use. The front page displays a list of your current scenes, as well as a list of all of your lights and a quick-access button to flip them on and off. You can rename your lights from here if you wish.

Enlarge / The Hue Web portal's front page, showing my installed scenes and bulbs.

There is also a settings menu, where you can change your password, see details about your system, and, most interestingly, see a list of "my apps." There are no applications to be found yet, but the presence of the page is hopefully a sign of things to come.

Enlarge / The app page is bare, but with luck it will soon gain some contents.

Lighting up my life

The Hue bulbs fit into standard E26 light sockets, so I put all three from the starter kit into the three lights in my office. Ars is a work from home type of place, so I spend the vast majority of my day in here. My usual working environment is darkness except for the light of the computers' screens. This was the perfect testing ground for the lamps, since the lack of a window ensured they would be the primary illumination.

Firstly, the Hue bulbs work perfectly well as regular lights. Under normal usage you put them into a fixture or lamp and leave that fixture or lamp turned on, so that you can control the bulb through the app or Web gateway. However, if you forego the app and just turn the light on and off with the switch like a regular light, the bulb behaves just as a normal bulb would—it turns off when the switch turns off, and turns on when the light turns on. Unfortunately, it doesn't remember its prior state when activated in this fashion, coming on at full intensity and with a color temperature close to that of a standard incandescent. Still, this is ultimately a very good thing. You don't have to fumble around with unlocking your phone and starting up an app just to turn the lights on.

If you do use the app, you can make the LEDs in the Hue lights produce a broad range of colors. I fiddled a bit with the manual light adjustments and was quickly able to bathe my office in all kinds of garish shades:

Enlarge / Changing the room colors to wacky extremes is fun, though it's possible to get carried away. The third light is behind the camera and isn't pictured.

This was fun, and it would be even cooler if there were a way within the Hue app to have the lights adjust themselves based on external cues like audio, or automatically shift through a preprogrammed set of scenes or patterns. That way, you could program up a "My friends are coming over so bring on the partytimes" scene, and the lights would change every few minutes. It's possible to emulate this in the app by building a bunch of custom scenes and setting timers, but doing so is annoyingly tedious (at least within the confines of the official app).

When commanded to change their shade, the lights shift from source to target color in about one second rather than blinking instantly. This imparts a nice, polished effect that gives your eyes and brain some adjustment time. Most of the transitions are very smooth, but a few include a bit of blinking or odd unrelated colors popping up during the change. I didn't crack a lightbulb open to watch the individual LEDs, but I'm guessing the few uneven transitions are caused by the color and layout of the LEDs—apparently it's not possible to go from every place in Hue color space to every other place without a few hiccups. These transition blips are minor though, rarely seen.

The fade down to and up from zero, though, is a little rockier—the minimum amount of illumination the bulbs can provide is not dim enough for a smooth transition from off to on. Instead, the bulbs jump from off to their minimum nightlight-dim state, then fade up to their set level. When fading to off, they transition smoothly to their minimum level then wink out. It would have been really nice if there were a way to truly fade to off, but it doesn't appear possible.

Enlarge / Three views of the same light. At left, mimicking an incandescent light at minimum brightness, at f/4 and 1/6 shutter speed; at middle, full red with the same settings; at right, full red at f/1.8 and 1/200 shutter speed. Flash fired on all three. As an aside, taking pictures of lightbulbs is hard.

My setup includes two lights in enclosed fixtures in the corners of the room and the third unshielded behind my computer. I continually needed to dial down the intensity of the computer light to keep the room balanced (which makes sense, since the lamp behind the computer has its light bounced around by the corner). This was easily done by adjusting the intensity sliders to suit my taste. At full brightness, the bulbs do indeed give off about as much light as a 50 or 60-watt incandescent. At their dimmest, they provide a nice moody glow.

Enlarge / On the left, the light behind the computer is at its dimmest and the door light is at max; at right, it's the opposite, with the computer light at max and the door light dim.

In addition to trying out all the crazy colors, I wanted to see if the Hue lights could maybe bring some circadian reinforcement to my normally dark working environment. The built-in recipes for "concentration," "energizing," and "reading" provided good starting points. I was able to set up a trio of lighting schemes that vaguely reflected the time of day—one for sunrise, one for full day, and one for the evening. I assigned timers to these three custom scenes, and over the next day I enjoyed their automated effect. It was awesome to walk into my normally dark batcave at six o'clock and have the lamps glowing softly golden, then shift over to a daytime white at nine, then shift again to a softer yellow at five in the afternoon.

Enlarge / The author's office. Morning at top left, day at top right, evening at lower left, and night at bottom right.

This little taste of home automation was entrancing (and please, no comments from the gallery about how I could have gotten the same effect for free by opening a window—the yellow face hurts us). I was so excited by the possibilities of what else I could do with the Hue bulbs that I picked up three more of the things—then ran smack into the limitations of the Hue app.

Taking control

An obvious application of the Hue bulbs is to stick them in your bedroom and use them as a gentle visual alarm clock, but that plan is immediately stymied by the app's inability to set different schedules for weekends versus weekdays. Few people want to wake up at the same time on a Saturday as they do on a Monday, and the bare-bones alarm implementation means using Hue lights to wake you up requires manually disabling the schedule on weekends.

The ability to fade in is nice, but the lack of separate weekday and weekend schedules severely limits the scheduler's usefulness.

Using the lights in the rest of the house on a schedule presents a similar problem. Having my office lights come on at six o'clock to greet me on weekday mornings is awesome; having them come on by themselves at six on a Saturday and stay lit for four hours until I eventually mosey on in is a waste of electricity. More importantly, it wastes four hours off the bulbs' lifetimes (and at $60 per bulb, you'll want to squeeze every single dollop of life out of these things).

Fortunately, there is hope. A developer named Ross McKillop has done some extensive experimentation with his own Hue lights. McKillop discovered that although Philips has yet to release documentation on their API or an SDK for interacting with the Hue system, they appear to have purposefully left the system's bridge wide open for people to tinker. His efforts were centered around making Hue lights controllable by DMX systems, but he actually uncovered the key to making Hue lights work with just about anything: the Hue system responds to simple HTTP commands.

So maybe the bridge isn't wide open, but making it listen to you is a simple matter of pressing the pairing button on the bridge and then sending it a correctly formed JSON object via an HTTP POST request using cURL or whatever your preferred tool is. Once you get the bridge's attention and agree on a hash to use, you can control all of your connected lights directly, without needing to pull out the Hue app. McKillop's page documents all of his findings, which are extensive and extremely useful.

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).

Immediately, the scheduling issues presented by the Hue app fall away. Being able to control a lamp's state, brightness, and color via the command line means you can fall back on that old reliable tool, cron, to handle the scheduling for you. cron has absolutely no problem dealing with weekends and weekdays. After a bit of experimentation, I've settled on a schedule I'm quite happy with—the bedroom light slowly fades in from zero right when the alarm clock sounds, and at the same time the other Hue lights in the house kick on to their morning colors. At 9 a.m., my office shifts to day-colored and the rest of the Hue lights go out. At 5 p.m., my office shifts to evening and the other lights come on, and then at 9 p.m. all of the lights shift to nighttime colors. At some point, I turn them off and go to bed; if I forget, another script fires at 11:59 p.m. and turns them off for me. On weekends, things work to an entirely different schedule. My wife and I sleep uninterrupted by lights or alarms, the morning lights don't kick on in the office until much later, and the all-off command doesn't go out until 2 a.m. (By this point, I definitely need to be in bed to avoid zombification the next day.)

(Windows users who lack proper tools but don't want to be left out can get a standalone cURL binary here, and can use Task Scheduler in place of cron to schedule and run scripts.)

This is all quite unofficial. Sometimes the GET request returns the wrong state (as discussed on the unofficial Hue forums) for example. And since Philips hasn't yet released the API documentation or SDK they've promised to release, all of this could change at any point. Still, the groundwork has been laid for a lot of great things.

Like, how about your own Web control panel for your lights?

Taking it up a notch

It doesn't take much programming knowledge to use the information here to put together a custom Web interface for your Hue lights. Hell, I did it, and my programming skills are essentially zero. The key is to use just a bit of Javascript glue to send the necessary PUT commands, and the know-how to make that work can be picked up right here. The code requires a bit of tweaking, but it can be easily paired up with some quick HTML and CSS to yield something like this:

Enlarge / What you can play with if you come over to my place. No, it's not accessible from the Web. You guys would no doubt quickly drive me to epilepsy and madness.

I think I had just as much fun putting the control panel pages together as I did playing with the lights themselves (which says volumes about my mental state). The page is simple, divided up into functional sections, and focuses on getting the lights into predetermined states. The schedules I mentioned above are run independently, but if I want to quickly fiddle with a light or a group of lights, it's a lot simpler for me to pop open this quick Web page than it is to unlock my phone—I almost certainly have a Web browser open already on my desktop.

To figure out which values I wanted each button to set, I used the app to set the lights how I wanted, then grabbed their status with an HTTP GET. It was just a matter of figuring out the necessary Javascript functions from here, then determining out how to pass parameters to them on HTML button clicks. The resulting website consists of an HTML file (actually several HTML files, since I have Hue lights in several rooms now), a CSS file to style things, and a .js file to contain all the functions. The buttons all do things using onclick, passing the light number and a parameter or variable name to one of several functions in the .js file. For example, in the image above, the "Computer light on" and "Computer light off" buttons are made up op this code:

 <button class="lightbutton" onclick="lightswitch(3,true);">Computer light on</button> <button class="lightbutton" onclick="lightswitch(3,false);">Computer light off</button> 

The buttons pass on "3" (the number for the computer light) and "true" or "false" to the lightswitch function in the .js file, which looks like this:

 function lightswitch(light,state){         execute('PUT', 'http://'+bridge+'/api/'+hash+'/lights/'+light+'/state', '{"on":'+state+'}'); } 

The lightswitch function accepts the light and state arguments and plugs them into their slots (along with the bridge and hash variables, which are defined earlier in the file), and then runs the completed statement through the execute function. That's a modified version of the one linked earlier:

 function execute($method,$url,$message){ xmlhttp=new XMLHttpRequest(); xmlhttp.open($method,$url,true) xmlhttp.send($message); } 

I've zipped up a sample HTML file and its accompanying CSS and Javascript files for those who want to explore and customize further: download them here. You can host the page on a Web server on your LAN if you have one, or just toss the files all in the same directory and open the index.html files directly in your browser window. The functions work without any problems in Firefox, Chrome, and mobile Safari, but I didn't bother testing with any version of IE or Opera. Regardless, this is unsupported by anyone or anything and Philips could alter the API at any time to break some or all of it. No warranty is expressed or implied, void where prohibited, and so on.

Competition

But what if you want to get your color-changing Wi-Fi-controlled LED lights on, but you don't want to put $199 into a Hue starter kit? If you're willing to wait a bit, you can pick up a LIFX bulb as soon as they're available. LIFX is essentially the same type of color-changing LED bulb as Hue, except it's crowdfunded and uses Wi-Fi to actually communicate with its bulbs instead of Zigbee Light Link. LIFX lights won't require a base station, but instead will talk among themselves to create a Wi-Fi mesh. Control of the bulbs will be done via an iOS or Android app.

Additionally, the LIFX devs will release their own SDK, and have repeatedly said they will embrace community-based hacks and modifications. Their latest Kickstarter update indicates that LIFX will easily integrate with services like ifttt.com, something Hue users have repeatedly asked for on the unofficial Hue forums.

Between the two technologies, LIFX will likely be the more community-friendly. Their Kickstarter smashed its funding goal and sold out in less than two days, but the LIFX folks face a significant disadvantage in that Hue is first to market—currently, LIFX is estimating March 2013 as their shipping date, though this has slipped before and can easily slip again. Also, if the Kickstarter pricing is any indication, the production LIFX bulbs won't be any cheaper than Hue bulbs, so choosing between the two will almost certainly come down to which is actually available to buy, and whether you want to support a group of independent developers or Royal Philips Electronics. To Philips' credit, though, the Hue is currently quite accessible and the company does appear to be very mod- and hack-friendly.

Want some? Good luck!

Speaking of availability, the news there is currently not so great. As noted, Hue starter kits and individual bulbs are only available through the Apple Store, and the shipping times on both the three-bulb starter pack and individual bulbs is currently showing three to four months. Actually acquiring a Hue starter kit at this point is a matter of scouring individual Apple Stores to see if there are any still left on the shelf. Out of the five Apple Stores in Houston, only two have units in stock (though the closest store to me, in Baybrook Mall, had four starter kits and easily a dozen bulbs on the shelf when I stopped in to check. I ended up buying three more lights to complement my starter kit).

I reached out to Philips to ask about when more Hue lights might be available, and Philips confirmed Hue will remain an Apple Store exclusive for the foreseeable future. The dates posted on the Apple Store page are indeed the official dates. They are scrambling to produce additional bulbs as soon as possible, but they appear to have underestimated the demand for the product. It's entirely possible that LIFX bulbs will be shipping before you'll be able to get your hands on some Hue bulbs, unless your local Apple Store has some left in stock.

We are Hue

On one hand, it's hard to recommend spending $200 on what are essentially three colored lightbulbs. Cheaper alternatives exist, though they lack most of the features that make Hue so damn fun. On the other hand, after living with the lights for a couple of weeks, it's at this point impossible to imagine life without them. I've already augmented the starter kit with three more lights, and I plan on raiding the Apple Store's stock and picking up another half-dozen shortly. The slick integration and remote control features are just downright captivating, and I am absolutely in love with being able to light up rooms in my house on a schedule, coupled with the ability to instantly invoke some funky mood lighting.

The lack of a formally released API and SDK might give truly hard-core enthusiasts and app developers pause, though enough has leaked out to give those folks a good start on their hacking efforts. It's hard to imagine Philips will do a better job of community support than the open-minded LIFX crew, but on the other hand Philips has actually shipped their product. Supply constraint issues aside, their bulbs definitely work as advertised and are available today.

My recommendation is that if you have the spare cash, they are worth buying. They're just too fun and too addictive to not own. With the holiday season upon us, they even provide a neat way to spread ChristmaHanuKwanzakkah cheer in your home. Plus, they project an awesome "I AM LIVING IN THE FUTURE" vibe—who doesn't want to live in the future?

The Good

  • High build quality
  • Dead-easy to set up
  • Excellent range of colors, from "normal" illumination hues to crazy funhouse lighting
  • Extensible, customizable, hackable control scheme is hella fun and addictive
  • Schedules and timers make for easy home automation
  • Might ruin normal lights for you forever

The Bad

  • Official app is a bit clunky and not that geek-friendly
  • It's not immediately obvious how to control different groups of lights
  • No way to set separate weekday and weekend timers without taking matters into your own hands
  • No official API or SDK yet
  • Might ruin normal lights for you forever

The Ugly

  • Sadly, there's no getting around that price tag

Laura Schlessinger more stories

2 comments:

  1. Am i missing the link for the Philips Hue web ZIP? Would love to have a play if poss, thanks...

    ReplyDelete