Category Archives: python

Improved advanced settings

A new version of the add-on is available on Github, version 0.5.1!

Version 0.5.1 is more stable, has better control over the advanced settings, adds debug logging and support Philips livingwhite bulbs.

Download the latest version from GitHub:

https://github.com/cees-elzinga/script.xbmc.hue.ambilight/

Should you run into any problems, please enable the “debug logging” from the advanced settings panel. It will log a bunch of information to your xbmc.log that will greatly help me to debug the issue at hand.

xbmc addon

Advertisements

XBMC add-on for Philips Hue

Note: this post old, see meethue.wordpress.com 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 (http://www.pythonware.com/products/pil/)

Download script.xbmc.hue at GitHub

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

plugin2

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.

nemo

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:

run_1

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.

sample_picspectrum

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:

run_2

Next up: building a  XBMC package

Update 2013-03: The XBMC add-on is available, see https://meethue.wordpress.com/2013/02/22/xbmc-add-on-improved-ambilight/