mpolednik / script.kodi.hue.ambilight

Kodi add-on for Philips Hue lights with ambilight support. Based on @cees-elzinga 's original work.
Do What The F*ck You Want To Public License
157 stars 42 forks source link

cannot setup groups #57

Open chris400 opened 7 years ago

chris400 commented 7 years ago

Installing and discovering the bridge worked just fine. I cannot setup groups, the UI just does nothing. I am running LibreELEC 8.0.1 on an Intel NUC. Kodi.log:

23:22:52.819 T:139869871388416 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--

  • NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS! Error Type: <type 'exceptions.KeyError'> Error Contents: ('bri',) Traceback (most recent call last): File "/storage/.kodi/addons/script.kodi.hue.ambilight/default.py", line 80, in onNotification self.settings.ambilight_group File "/storage/.kodi/addons/script.kodi.hue.ambilight/resources/lib/ui.py", line 13, in multiselect_lights lights = bridge.get_lights_by_ids(bridge_ip, bridge_user) File "/storage/.kodi/addons/script.kodi.hue.ambilight/resources/lib/bridge.py", line 78, in get_lights_by_ids res[light_id]) File "/storage/.kodi/addons/script.kodi.hue.ambilight/resources/lib/lights.py", line 35, in init self.init_bri = spec['state']['bri'] KeyError: ('bri',) -->End of Python script error report<--
evildrummer commented 7 years ago

same here :(

JesCR commented 7 years ago

Hi! Are you using the official skin? there are some problems with some skins like eminence... Try to setup the addon with the estuary skin. Select the lights and press ok.

chris400 commented 7 years ago

I am using the official skin.

JesCR commented 7 years ago

Ok, next common issue: Non ascii characters in the name of the lights?

evildrummer commented 7 years ago

I Run it in the nvidia shield and I am using the aeon nox skin on Kodi 17.1

So it only work with the official skin? :(

JesCR commented 7 years ago

Nope, but some users reports that part of the ui (ok button) is not visible with eminence skin... I use nvidia shield and qnap nas with estuarymod... Just try to setup with the official skin...

chris400 commented 7 years ago

Only ASCII chars. Version 0.7.2 was working fine on older Kodi/LibreELEC

hstamas commented 7 years ago

are you using Kodi 16 by changes?

chris400 commented 7 years ago

@hstamas do you asked, if I have update my Kodi from previous release instead of fresh install? Yes, I do.

hstamas commented 7 years ago

Kodi 16 doesn't work with the master branch of this plugin. I didn't realize this awhile back and was experiencing settings that wouldn't stick. By using Kodi 17 my issues were fixed.

chris400 commented 7 years ago

LibreELEC 8.0.1 ist based on Kodi 17.1

evildrummer commented 7 years ago

i´m using Kodi 17.1 on a Nvidia Shield 2017.

Here´s my logfile.

21:46:40.078 T:138315596880 WARNING: RunScript called for a non-script addon 'script.kodi.hue.ambilight'. This behaviour is deprecated. 21:46:40.620 T:138970907728 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--

Can´t click on any option "setup ambilight group" for example. The connection to my Bridge is fine.

evildrummer commented 7 years ago

any suggestions?

mpolednik commented 7 years ago

What kind of hue lights are you using?

evildrummer commented 7 years ago

I´m using the second gen Hue Bulbs and the Bridge

chris400 commented 7 years ago
  1. gen bridge, Lightstripe, Iris, Bloom, Lightify plug
evildrummer commented 7 years ago

So i guess i won´t be able to use this script :-/

woutf commented 7 years ago

I'm having the exact same problem. When I select 'Setup theather lights' nothing happens. Pairing with the Bridge works just fine. Running Kodi 17.3 on Nvidia Shield TV with Estuary. Gen 2 bridge with white Hue lights.

EvilHidden commented 7 years ago

Same issue for me as well. Pairing is good. Can't setup any groups. UI does nothing. Kodi 17.3 on Esturary.

Log: https://pastebin.com/Tfn9Gsra

silentgecko commented 7 years ago

i'm using Kodi 16 and have the exact same issue everything is configurable - except the ambilight/theater/static groups. i'm running my kodi on my qnap nas

edit: alright, under kodi 17 it works fine. finally a reason to upgrade ;)

evildrummer commented 6 years ago

Still no one with shield 2017 and Kodi 17.4 who's struggeling with that kind of problem ?

Thors77 commented 6 years ago

Same problem since update to Kodi 17.3

zwicknoob commented 6 years ago

I also had the problem but after a factory reset of the hue bridge everything works fine.

evildrummer commented 6 years ago

Damn it. So i have to reconfigure all my bulbs/scences in the hue app and my harmony and its not guaranteed that this will help? :-/

chris400 commented 6 years ago

Dito.

Everything else is working fine (Hue App iOS, Android, ifttt, openHAB).

It's disappointing that there is no logentry and no error message.

zwicknoob commented 6 years ago

From the time when I connect the Logitech Hub with the Hue Bridge the error is present again.

hvf81 commented 6 years ago

I had the same error. In my case the problem was with the osram plug, these don't have a value for sat and bri (saturation and brightness). The script lights.py has a check if there is no value for sat but not for bri. If you replace the code on line 35 in C:\Users_username_\AppData\Roaming\Kodi\addons\script.kodi.hue.ambilight\resources\lib\lights.py from: self.init_bri = spec['state']['bri'] to: try: self.init_bri = spec['state']['bri'] self.bri = self.init_bri except KeyError: self.livingwhite = True the configuration works. Just copied the try except from the check for the sat value.

A second workaround: Go to the webserver of the bridge http://*bridge_ip*/api/*bridge_user*/lights. Find the number of the light(s) you want to use with kodi and put them directly in the config file. C:\Users_username_\AppData\Roaming\Kodi\userdata\addon_data\script.kodi.hue.ambilight\settings.xml. Edit the line: to include the number of the lights:

There is another problem with the code if you select lights without the colours for ambilight. I have 2 white ambiance lights and wanted to use them with the ambilight function just adjusting the brightness with the rest of the colour lights is good enough for me. When you select these lights and start playing a movie the add-on crashes and you find this in the log files: 15:35:28.558 T:10616 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--

def transition_colorspace(hue, light, hsvratio): fullspectrum = light.fullspectrum h, s, v = hsvratio.hue( fullspectrum, hue.settings.ambilight_min, hue.settings.ambilight_max ) hvec = abs(h - light.hue) % int(65535/2) hvec = float(hvec/128.0) svec = s - light.sat vvec = v - light.bri

changed to squares for performance

distance = math.sqrt(hvec**2 + svec**2 + vvec**2)
if distance > 0:
    duration = int(10 - 2.5 * distance/255)
    light.set_state(hue=h, sat=s, bri=v, transition_time=duration)

` to

` import math

def transition_colorspace(hue, light, hsvratio): fullspectrum = light.fullspectrum h, s, v = hsvratio.hue( fullspectrum, hue.settings.ambilight_min, hue.settings.ambilight_max ) if light.hue is None: light.hue = 1 hvec = abs(h - light.hue) % int(65535/2) hvec = float(hvec/128.0) if light.sat is None: light.sat = 1 svec = s - light.sat vvec = v - light.bri

changed to squares for performance

distance = math.sqrt(hvec**2 + svec**2 + vvec**2)
if distance > 0:
    duration = int(10 - 2.5 * distance/255)
    light.set_state(hue=h, sat=s, bri=v, transition_time=duration)

` If the value does is not there i just set it to 1, it works for me.

The changed scripts are in the attached zip file.

files.zip

zwicknoob commented 6 years ago

No idea what it is for me. Maybe my Osram ON / OFF plug? Only after a reset of the bridge, I can once select the bulbs and then it does not work anymore. But after I inserted both scripts, everything works as it should! Good job! Thank you!

chris400 commented 6 years ago

Thx @hvf81!

I have an Osram Lightify Plug. What about the others, do you have a Osram Plug or anything similar as described by hvf81?

L4c commented 6 years ago

Yes I also have Osram Lightify Plug, and I also have a same problem. Once I'm back home I'll try the script.

mpolednik commented 6 years ago

@hvf81 Would you mind opening a pull request with those changes? I'm fine doing it myself, but I don't want to take your credit for it.

hvf81 commented 6 years ago

@mpolednik I created the pull request. Hope i did it correct. If not feel free to do it for me, don't care that much about the credit. Just wanted to use the add-on, i like the ambilight functions!

ratyfu commented 6 years ago

@mpolednik First of all, thank you so much for this plugin!

For me the fix isn't solving the problem. I also have Osram components, i.e. the Lightify Strip. Only after updating to Kodi 17.6, updating the Hue bridge and removing/readding the Lightify Strip, did it stop working. Before all that, I could still access the groups settings. The colors of the Lightify Strip were wrong, though. I'm mainly using a Hue Go for Ambilight, so I didn't mind, really. Looks cool enough like that! 👍

Here's my log:

14:15:15.648 T:10108   DEBUG: Kodi Hue: In .(argv=['']) service started, version: 1.0
14:15:15.697 T:10108   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.KeyError'>
                                            Error Contents: ('8',)
                                            Traceback (most recent call last):
                                              File "C:\Users\rrrr\AppData\Roaming\Kodi\addons\script.kodi.hue.ambilight\default.py", line 313, in <module>
                                                hue = Hue(settings, args)
                                              File "C:\Users\rrrr\AppData\Roaming\Kodi\addons\script.kodi.hue.ambilight\default.py", line 169, in __init__
                                                self.update_controllers()
                                              File "C:\Users\rrrr\AppData\Roaming\Kodi\addons\script.kodi.hue.ambilight\default.py", line 202, in update_controllers
                                                self.settings.ambilight_group.split(',')),
                                              File "C:\Users\rrrr\AppData\Roaming\Kodi\addons\script.kodi.hue.ambilight\resources\lib\bridge.py", line 78, in get_lights_by_ids
                                                res[light_id])
                                            KeyError: ('8',)
                                            -->End of Python script error report<--

Edit: I managed to get it working again by doing a clean install of the plugin. User error in that case, I suppose. :)

The Lightify strip still isn't able to show the right colors. Especially when they are red tones. But then again, the script is called Kodi Hue Ambilight and not Lightify Ambilight, so I don't bother.

sanwink commented 6 years ago

@hvf81. Thanks for the files it fixt the problem for me.

Only ambilight not working om my Mutant 4K HD51 box. Is there a way to fix this?

It works great om my PC. Nice work.!