script.kodi.hue.ambilight icon indicating copy to clipboard operation
script.kodi.hue.ambilight copied to clipboard

cannot setup groups

Open chris400 opened this issue 8 years ago • 34 comments

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<--

chris400 avatar Apr 12 '17 21:04 chris400

same here :(

evildrummer avatar Apr 13 '17 20:04 evildrummer

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.

JesCR avatar Apr 14 '17 08:04 JesCR

I am using the official skin.

chris400 avatar Apr 14 '17 08:04 chris400

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

JesCR avatar Apr 14 '17 09:04 JesCR

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? :(

evildrummer avatar Apr 14 '17 09:04 evildrummer

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...

JesCR avatar Apr 14 '17 10:04 JesCR

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

chris400 avatar Apr 14 '17 11:04 chris400

are you using Kodi 16 by changes?

hstamas avatar Apr 14 '17 17:04 hstamas

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

chris400 avatar Apr 16 '17 16:04 chris400

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.

hstamas avatar Apr 16 '17 19:04 hstamas

LibreELEC 8.0.1 ist based on Kodi 17.1

chris400 avatar Apr 16 '17 21:04 chris400

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<-- - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS! Error Type: <type 'exceptions.KeyError'> Error Contents: ('bri',) Traceback (most recent call last): File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.kodi.hue.ambilight/default.py", line 80, in onNotification self.settings.ambilight_group File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.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/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.kodi.hue.ambilight/resources/lib/bridge.py", line 78, in get_lights_by_ids res[light_id]) File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.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<-- 21:46:41.437 T:138315596880 WARNING: RunScript called for a non-script addon 'script.kodi.hue.ambilight'. This behaviour is deprecated. 21:46:41.975 T:138970907728 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/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.kodi.hue.ambilight/default.py", line 58, in onNotification self.settings.theater_group File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.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/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.kodi.hue.ambilight/resources/lib/bridge.py", line 78, in get_lights_by_ids res[light_id]) File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.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<--

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

evildrummer avatar Apr 18 '17 09:04 evildrummer

any suggestions?

evildrummer avatar Apr 26 '17 12:04 evildrummer

What kind of hue lights are you using?

mpolednik avatar Apr 26 '17 13:04 mpolednik

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

evildrummer avatar Apr 26 '17 13:04 evildrummer

  1. gen bridge, Lightstripe, Iris, Bloom, Lightify plug

chris400 avatar Apr 26 '17 17:04 chris400

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

evildrummer avatar May 03 '17 13:05 evildrummer

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.

woutf avatar May 25 '17 18:05 woutf

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

EvilHidden avatar Jun 10 '17 03:06 EvilHidden

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 ;)

silentgecko avatar Jul 09 '17 09:07 silentgecko

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

evildrummer avatar Sep 27 '17 18:09 evildrummer

Same problem since update to Kodi 17.3

Thors77 avatar Nov 03 '17 19:11 Thors77

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

zwicknoob avatar Nov 09 '17 18:11 zwicknoob

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? :-/

evildrummer avatar Nov 10 '17 05:11 evildrummer

Dito.

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

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

chris400 avatar Nov 10 '17 09:11 chris400

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

zwicknoob avatar Nov 10 '17 14:11 zwicknoob

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<-- - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS! Error Type: <type 'exceptions.TypeError'> Error Contents: unsupported operand type(s) for -: 'int' and 'NoneType' Traceback (most recent call last): File "C:\Users\Username\AppData\Roaming\Kodi\addons\script.kodi.hue.ambilight\default.py", line 316, in run() File "C:\Users\Username\AppData\Roaming\Kodi\addons\script.kodi.hue.ambilight\default.py", line 259, in run hue, hue.ambilight_controller.lights.values()[i], hsv_ratios[i], ) File "C:\Users\Username\AppData\Roaming\Kodi\addons\script.kodi.hue.ambilight\resources\lib\algorithm.py", line 9, in transition_colorspace hvec = abs(h - light.hue) % int(65535/2) TypeError: unsupported operand type(s) for -: 'int' and 'NoneType' -->End of Python script error report<-- This error is because the white ambiance doesn't have a value HUE and also not SAT. My workaround is changing the file: C:\Users_username_\AppData\Roaming\Kodi\addons\script.kodi.hue.ambilight\resources\lib\algorithm.py from: ` 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 ) 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(hvec2 + svec2 + 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(hvec2 + svec2 + 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

hvf81 avatar Nov 19 '17 14:11 hvf81

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!

zwicknoob avatar Nov 19 '17 16:11 zwicknoob

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?

chris400 avatar Nov 20 '17 07:11 chris400

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

L4c avatar Nov 20 '17 14:11 L4c