Phillips Hue

XTension build 847 now supports the ZigBee based LED color changing light bulbs from Phillips and sold on the Apple Store and elsewhere. You can control them just like any other device in XTension with the addition of being able to adjust their white color temperature and their color. They are capable of doing alerts, flashing or changing color to let you know about something in your system. I love being able to tune the white color temperature. LED bulbs that may look good with a cooler temperature when bright often look grey or strange to me when dimmed. Too long growing up under incandescent bulbs I guess but I expect a bulb to get warmer when it's dimer and with these you can simulate that.

What You Need

You will need at least the phillips bridge and one bulb. They come in a starter pack with the bridge and 3 bulbs. At this moment you cannot add the phillips bulbs to any other ZigBee controller so in order to use these you must use the phillips bridge. It is possible to connect other ZigBee lamps or controllers to the Hue Bridge though so you may be able to use most other ZigBee lighting products with this as the controller.

Setting up the Bridge

Follow Phillips instructions for the initial setup and linking the lights with the bridge (they should come out of the starter pack all linked and ready to go) Though it's not strictly necessary it will save you problems later if you dig deeper into the configuration and set up the bridge with a static IP, or do a DHCP reservation in your airport or other internet router so that the bridge will always get the same IP on your local network.

Connecting to the Bridge from XTension

In XTensions preferences window create a new interface and set it's type to “phillips hue bridge” if you dont know the IP address of the bridge you can click the “Search For Bridge” button which will go out to Phillips cloud service and ask it what the registered local IP of your bridge is. This is how all the IOS apps find a bridge to talk to on your local network but I have found it's not always updated if you change things.

Next you need to create a user in the bridge for XTension, so that it knows it's supposed to accept commands from us. Click the “create user” button and XTension will verify that it can talk to the bridge and then ask you to press the button on the center of the bridge. After pressing the button XTension will tell you that it's successfully setup and you can click save and then enable the interface and start it up by clicking the checkbox in the preferences list. Once the bridge is initially connected to it will print in the log window some information about the devices found connected so you can setup units.

Making the XTension units

If you have the starter pack then you have 3 bulbs that are addressed 1, 2, and 3. Create a new unit in XTension, set it's interface to the one you created in the previous step and the device type to “zigBee Device”. Fill in the address field with “1” Check the “dimmable” checkbox and set the dim type to “smart”. Save the unit and repeat for the other 2 bulbs. You should now be able to control the bulbs, try turning them on and off. You may need to use the dimmable slider to brighten them all the way to 100 before everything comes into sync with the bridge. All the regular unit control verbs can be used with them just as if they were any other type of unit. There are several additional commands that they support though.

Controlling Color

The hue bulbs have 2 ways of setting their color, a hue/saturation number or an x/y coordinate system. XTension also supports a conversion from standard web colors expressed in the standard notation of 6 characters of hex for red green and blue. “RRGGBB” format. The hue bulbs seem heavy on the red so to get the colors to match what you see on a swatch you'll need to reduce the amount of red you're sending somewhat. XTension lets you use any of these ways to set the color. A color change must accompany a turnon command or a dim command, but the brightness of the bulb is inherent in the color, so the current brightness level of the lamp may change to be different from the dim or the current value you have set.

turn on "hue device" rgb color "AAFF22" 

sets a reasonable yellow. The other forms of sending color are via hue/saturation or the x/y like this:

turn on "hue device" hue 45032 saturation 200
turn on "hue device" xValue 0.134 yValue 0.441

You can set the color in XTension also by control clicking on the unit in any list and selecting “set color” which brings up a standard system color picker that you can choose from.

As of XTension build 850 and later the color data as XTension knows it will always be sent with any on or dim command. This is useful since the bulbs do not remember their color state when the power goes out and will return to white. It also adds the ability to change what this stored value is while the light is off using the sim preset command like:

sim preset "hue device" to 100 rgb color "AAFF22"

if the light is off that will not cause the light to go on, but the next time you issue an on without color data specified it will pass that level and color to the bulb.

You can see what color the bulb is current set to, or get a good color you like out that you've set from some separate controller by control clicking on the unit and selecting “edit unit properties” you'll get a display that looks like this. The “color mode” will tell you which values are actually being used right now. “hs” means that the Hue and Saturation values are the ones you're seeing, if it says xy then those numbers are currently active. If it says “ct” then the bulb is in “white” mode and the Color Temperature value is what is being displayed. You can read out these values and send them in verbs to get the same color later from XTension.

White Color Temperature

You can change the color temperature of the white being displayed by using the “color temperature” parameter of the turn on or dim verb like:

turn on "hue device" color temperature 300

will produce a good warm white. The valid range is from 153 for a very cool white up to 500 for something that looks more like orange to me. So I can have cool white when I”m working with sunlight adding to the room light and then warm things up in the evening when it's dark outside and the cool would look grey. This is really a nice adjustment to make.

alerts and color fades

The phillips bulbs support some alert and color fade modes accessed via the “blink” verb in XTension.

blink "hue device" rate "select"

produces a single flash.

blink "hue device" rate "lselect"

for “long select” will flash the bulb for 30 seconds. And can be canceled by you at any time by running the command again and passing “none”

blink "hue device" rate "colorloop"

starts the bulb slowly cycling through all it's colors and can be cancelled by setting it to a specific color or white or running the command again and passing “none” There seem to be some holdover from other commands as to how deeply saturated the color loop colors are and the rate at which they change. This doesn't appear to be documented so some experimentation might be necessary to get the effect you want here. It seems that you can issue other color change while the loop is running to change the saturation and brightness.

Other Scripting and Examples

all the commands support the “rate” parameter. So you can fade very slowly from one color or white temperature by adding “rate 500” to the end of the command or make the change happen immediately by setting 0.

Commands will override the one previous, so if you start a fade and then send immediately another command the fade will be interrupted or maybe not be visible at all before the next command is sent. For example if you do this:

turn on "hue device" rgb color "FF2222"
turn on "hue device" color temperature 300

to get a red flash for an alert it may not actually show any red at all. The “in” parameter in XTension is supported with colors (but not the “for” parameter) so you could do something like this instead:

turn on "hue device" rgb color "FF2222" rate 0
turn on "hue device" color temperature 300 in 2

which would give you 2 seconds of red and then return to normal.

supported_hardware/hue.txt · Last modified: 2013/09/29 15:46 by James Sentman
CC Attribution-No Derivative Works 3.0 Unported Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0