XBMC add-on: improved ambilight

Version 0.3 is out with improved ambilight mode and improved support for handling lights simultaneously.

Available at: GitHub: script.xbmc.hue

Please check the README instructions on github, you’ll need to install scripts.module.requests.

A small preview:

26 thoughts on “XBMC add-on: improved ambilight

  1. Bruno

    Just tested the theater mode again with this new version (on Win7). I looks a bit more responsive.

    But maybe mension in the article that you must install the “requests” add-on, because I only read the readme file with instructions after trying to find out why it didn’t work, which took a while 😉
    I can imagin many other people would just replace the add-on files, without reading the readme 🙂

    Reply
  2. Daniel

    It’s not working for me. It just says “script failed! : script.xbmc.hue” every time i start XBMC.
    I’m running xbmc Frodo on mac.
    And what is bridge user?

    I really want this to work. Looks nice. Great work.

    Reply
    1. meethue Post author

      Hi Daniel.

      First: when talking to the bridge it needs a “username”. You generally don’t have to worry about it. When you go to the settings of the plugin and hit “Start bridge discovery”, it will create a user for you automatically and it will pop-up in the “bridge user” field.

      For the error: can you check the log file for errors?
      Its located at /Users/username/Library/Logs/xbmc.log

      If you look for “script.xbmc.hue” in the bottom of that file (just search for it) you should see why it failed.

      Reply
  3. Daniel

    Thanks for the quick reply.
    This is what it says in the log:

    21:47:31 T:4540944384 NOTICE: XBMC Hue: Service started
    21:47:31 T:4558725120 NOTICE: Thread CRssReader start, auto delete: false
    21:47:31 T:4540944384 ERROR: EXCEPTION Thrown (PythonToCppException) : –>Python callback/script returned the following error<–
    – NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
    Error Type:
    Error Contents: list indices must be integers, not str
    Traceback (most recent call last):
    File “/Users/danielfisk/Library/Application Support/XBMC/addons/script.xbmc.hue/default.py”, line 236, in
    hue = Hue(settings, args)
    File “/Users/danielfisk/Library/Application Support/XBMC/addons/script.xbmc.hue/default.py”, line 78, in __init__
    self.update_settings()
    File “/Users/danielfisk/Library/Application Support/XBMC/addons/script.xbmc.hue/default.py”, line 134, in update_settings
    self.light = Group(self.settings.bridge_ip, self.settings.bridge_user)
    File “/Users/danielfisk/Library/Application Support/XBMC/addons/script.xbmc.hue/resources/lib/tools.py”, line 128, in __init__
    Light.__init__(self, bridge_ip, bridge_user, 2)
    File “/Users/danielfisk/Library/Application Support/XBMC/addons/script.xbmc.hue/resources/lib/tools.py”, line 75, in __init__
    self.get_current_setting()
    File “/Users/danielfisk/Library/Application Support/XBMC/addons/script.xbmc.hue/resources/lib/tools.py”, line 85, in get_current_setting
    “on”: j[‘state’][‘on’],
    TypeError: list indices must be integers, not str
    –>End of Python script error report<–

    Reply
  4. meethue Post author

    Could you confirm the following:
    – the auto discovery worked and in the settings screen, there’s an IP address and a bridge user (or if you manually put these there it’s fine too)
    – the select light is set to “Use all lights”

    When the lights option is set to “use all lights”, the first thing it does is check the settings of light number 2 (it will use this information to restore the lights to their original setting). It appears the scripts fails at this point. It might be there is no light “2” in your environment.

    Could you try changing the light setting to “light 1” and see what happens?

    If this still fails can also identify the light numbers in your environment? You’ll have to browse to the bridge at: “http://*insert IP address of bridge*/api/*insert bridge user*”. Then the number(s) it says before the words “state” are the ID’s of the lights. It might be a little tricky because you probably can’t copy and paste from XBMC

    Reply
  5. bug00

    Hi, same problem and… solved 🙂

    Auto discovery crash, so i had install postman for chrome and create an user on the bridge
    (In postman do a HTTP POST requete, RAW for data mode (not form-data) in JSON witdh this param :

    {“username”: “YOURSECRETUSERNAME”, “devicetype”: “DEVICENAME”}

    See http://rsmck.co.uk/hue for more detail

    For the device name you can see it on https://www.meethue.com/en-US/user/preferencessmartbridge (click on show more).

    Before send data press button on bridge. When done you should receive

    {“success”:{“username”:”key”}}

    On XMBC in setting, you can enter IP of the bridge and username previously send to the bridge.

    And it’s ok.

    First time i hear about hue, i think movie, python, PIL… I get Hue this morning and i see that u develop it ! Fabulous ! Very good script !

    Reply
  6. meethue Post author

    Hello Henry,

    No. It’s great to see Philips is opening up to the community. But most information was already available and I reversed parts myself. It will be easier to get started for new developers though, especially for iOS

    Reply
  7. Pingback: XBMC and Philips Hue ambilight, Part 1 | Meet Philips Hue

  8. MichMich

    Hi !!!
    The plugin is great ! Thank you !!!
    As bug00 said, I had to create a new user by my own (it’s quite simple, just need to go to http://Your-IP-Hue-Bridge/debug/clip.html and put some JSON code) otherwise I got a python message error in XBMC.

    Is it possible to add some features :
    – once the movie is finished or when I stop the movie, is it possible to turn off the light ? (or to put it in the same state before watching the movie)
    – when I watch some dark movie, the light is too strong.
    – 90% is the yellow/red color and I never saw the lamp becoming green or blue (I watched some animated movies like madagascar and it’s always yellow/orange/red).

    Thank you again 🙂

    Reply
    1. meethue Post author

      Hello MichMich. I just pushed an update on Github that fixes an issue when configuring the add-on. If you want you can try the latest version and use “auto discovery” from the settings menu.

      – turning off the lights when the movie is finished is definitely possible. in “theatre” mode it already restores the lights to the old state when the movie is finished
      – it would be relatively easy to tune a max brightness by settings a parameter in the settings screen (and using that in the set_light2() function in tools.py)
      – probably the average color ends up being a “light blue” or “light green”, and those look a “white” and “yellow-ish”. (try it out with the app).

      thanks for the response. unfortunately i don’t have the time to add these features, but feel free to add them yourself 🙂

      Reply
  9. Chris

    I get this error all the time I enable the plugin
    20:04:23 T:140521322309376 NOTICE: XBMC Hue: Service started
    20:04:23 T:140521322309376 ERROR: EXCEPTION Thrown (PythonToCppException) : –>Python callback/script returned the following error<–
    – NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
    Error Type:
    Error Contents: (‘hue’,)
    Traceback (most recent call last):
    File “/storage/.xbmc/addons/script.xbmc.hue.ambilight-master/default.py”, line 295, in
    hue = Hue(settings, args)
    File “/storage/.xbmc/addons/script.xbmc.hue.ambilight-master/default.py”, line 86, in __init__
    self.update_settings()
    File “/storage/.xbmc/addons/script.xbmc.hue.ambilight-master/default.py”, line 162, in update_settings
    self.settings.undim_hue,
    File “/storage/.xbmc/addons/script.xbmc.hue.ambilight-master/resources/lib/tools.py”, line 79, in __init__
    self.get_current_setting()
    File “/storage/.xbmc/addons/script.xbmc.hue.ambilight-master/resources/lib/tools.py”, line 97, in get_current_setting
    “hue”: j[‘state’][‘hue’],
    KeyError: (‘hue’,)
    –>End of Python script error report<–
    20:04:23 T:140523914131264 DEBUG: —— Window Init (DialogKaiToast.xml) ——

    Reply
    1. meethue Post author

      Chris, are you using the ambilight version of the add-on or the default version? And what version are you running? Could you try the latest version of the ambilight add-on and see it that works?

      Reply
  10. Tory Harvey

    I can’t Get auto discovery to work. I type in my ip and i still get script rashes. Im running windows 8

    ERROR: EXCEPTION Thrown (PythonToCppException) : –>Python callback/script returned the following error<–
    – NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
    Error Type:
    Error Contents: timed out
    Traceback (most recent call last):
    File “C:\Users\Arcade\AppData\Roaming\XBMC\addons\script.xbmc.hue.ambilight-master\default.py”, line 462, in
    hue = Hue(settings, args)
    File “C:\Users\Arcade\AppData\Roaming\XBMC\addons\script.xbmc.hue.ambilight-master\default.py”, line 103, in __init__
    hue_ip = start_autodisover()
    File “C:\Users\Arcade\AppData\Roaming\XBMC\addons\script.xbmc.hue.ambilight-master\resources\lib\tools.py”, line 55, in start_autodisover
    recv_data, addr = client_socket.recvfrom(2048)
    timeout: timed out
    –>End of Python script error report<–

    Reply
  11. Wildchild

    Hi,
    I have problems with autodiscovery too. My Platform is Windows 8.1 and XBMC 13 beta 4
    There’s no way to get auto discovery works, the popup message tells me “Bridge Discovery Starting” message but nothing else. I set on debug mode and this is the messages in xbmc.log

    11:55:18 T:5420 NOTICE: Thread LanguageInvoker start, auto delete: false
    11:55:18 T:5420 NOTICE: –>Python Interpreter Initialized<–
    11:55:18 T:7076 NOTICE: XBMC Hue: DEBUG not connected
    11:55:18 T:5420 NOTICE: XBMC Hue service started, version: 0.6.2
    11:55:18 T:5420 NOTICE: XBMC Hue: DEBUG Starting discover
    11:55:19 T:7076 NOTICE: XBMC Hue: DEBUG not connected

    The bridge is on the same router and I haven't any problem with other app on bridge discovery.
    Also, after I install your add-ons, XBMC still freeze every time I close it and I have to manually kill the process in task manager. Tried many times, install/uninstall and also the Philips Hue (non-ambilight) add-ons…same story. Thanks in advance!

    Reply
    1. meethue Post author

      I haven’t done much work on the add-on lately, but auto-discovery always used to work. I guess something broke in updates of XBMC and/or Philips bridge. Don’t have the time to look into it unfortunately. Could you add a bug report to the issue tracker on github?

      Reply
    2. Brandon

      I realize this is an old thread, but I’m fairly new to the Philips Hue world and I love the sound of this…Unfortunately I’m having the same problem you were having. I get the Bridge Discovery Starting message but then nothing happens. I’ve also noticed the freezing when I try to close XBMC. I was wondering/hoping you found a fix for this? Any chance you could share the fix if you did fine one? Thanks in advance

      Reply
  12. Kooijtjemk2

    Exactly the same issue as Tory Harvey, on Windows 8.1.
    Hope anyone has the answer which solves the issue.

    Reply
  13. mosesvii

    yep, same issue as the others; the auto discovery fails. I imagine its not to do with Win 8.1 but more about the XBMC Gotham update.

    Reply
  14. Chibs

    Hi,

    I’m able to get the add on to work on Windows 8.1 with XBMC 12. The problem I’m having is around the Disable for short movies setting. It doesn’t seem to have an affect on anything. Am I correct in assuming the intended effect is to disable ambilight when watching tv shows (for example)? Also, how does it work in conjunction with the dimming a group of lights in the advanced settings? In other words, if I have the Disable for short movies setting checked will that override dimming a group of lights when playback starts?

    Any help in getting this to work is greatly appreciated. Thanks!

    Reply
    1. meethue Post author

      Hi Chibs. That setting should disable the add-on for movies that are shorter than 5 minutes It’s mainly used for trailers – during the trailers the add-on shouldn’t do anything, ut as soon as the movie starts the add-on kicks in. Hope that helps.

      Reply
  15. gruijter

    Any news on an update for Gotham? I would really like to use the Hue add-on, but I get the infamous script error when I try to do an auto discovery. This goes for both the ambilight- as the default versions…

    Reply
  16. martin

    my bridge was not found on the autoconfig button. manual settings get me to script error?

    i get an xbmc hue script error when i restart xbmc after installing the script.

    logfile sais something about getaddrinfo 11004 gaiaerror. i have connected to the bridge and created a user and in this process also gotten my bridge ip, wich i set in the hue app. what to do now? :/ would really appricite help.

    Reply
  17. matze

    Hi, I have Kodi (14.2) running on an IntelNUC w/ OpenELEC 5.0.8 with the latest hue add-on 0.6.2
    What I noticed is that OpenELEC and Kodi are starting so extremely fast that the network seems not fully up when it tries to launch the Hue Addon….and then I get the script error.
    Activating “Wait for network before starting Kodi” solved that issue completely…..and it is still starting fast…12s now, before that it was about 8-9s 🙂

    Reply

Leave a reply to Daniel Cancel reply