Category Archives: philips hue

Version 0.6.0

Version 0.6.0 is out with general improvements all around. Most work is done improving the ambilight colors. All work is done by Rob Walch (thanks). Full details are available on GitHub.




XBMC add-on for Philips Hue

Note: this post old, see for the latest information.

Version 0.1 of the XBMC add-on is available on GitHub! Make sure you install the Python PIL library first (

Download script.xbmc.hue at GitHub

It supports two modes of operations: “Theatre mode” and “Ambilight mode”.


The “Theatre mode” is fully functional. It will dim the lights when a movie starts playing, and turn them back on once stopped. The “Ambilight mode” needs some more work. The biggest issue is that it takes approximately 1 second to adjust the lights. The time is spent by the bridge, and I don’t see any quick way to improve it. For now – “Ambilight mode” works but will be out of sync with the video streams for at least 1 second. [update 2013-03: a new version of the add-on is available on github and has better response times]

Download script.xbmc.hue at GitHub

If you have any feedback, please leave a reply!

XBMC and Philips Hue ambilight, first steps

This post takes the first steps into creating an add-on for XBMC that controls your Philips Hue lights.


The add-on will consist of three parts:
1. Snapping pictures of the video
2. Calculating the most dominant/average color
3. Controlling the lights

I started with calculating the average color of an image. As a sample image I used the trailer for Finding Nemo, and snapped a picture every 10 seconds.

My first, naive, approach was to resize the image and iterate over every pixel in the image. For every pixel I updated a global “red”, “green” and “blue” counter, and devided the end result with the number of pixels. This works quite well, but the average colors are a bit dull. In a similar way I calculated average HSB values. There appears to be a small bug in my code (blue pictures get an average HSB of green-ish). The first results:


In a second attempt I still iterate over every pixel, but calculate how the pictures are aligned over the Hue spectrum. See the images below, where the right pictures shows the Hue spectrum from 0 to 360 degrees and how many pixels are in the image per Hue value.


For the resulting value I divide the Hue in 10 degree sections, and use this as the most occuring Hue (+5). So in the example the most dominant section/”bin” would be 20-30, and the resulting Hue will be 20 + 5 = 25.

The results:


Next up: building a  XBMC package

Update 2013-03: The XBMC add-on is available, see