cees-elzinga / script.xbmc.hue.ambilight

XBMC add-on for Philips Hue lights with ambilight support
Do What The F*ck You Want To Public License
127 stars 123 forks source link

Support for Living Whites Plug #18

Closed tetzlav closed 10 years ago

tetzlav commented 10 years ago

If i try to dim only one of my LW plug in Theatre mode i get:

16:46:58 T:2810977088  NOTICE: XBMC Hue: DEBUG creating Light instances
16:46:59 T:2810977088  NOTICE: XBMC Hue: DEBUG class Hue: flashing lights
16:46:59 T:2810977088  NOTICE: XBMC Hue: DEBUG set_light: 5: {"on":true,"bri":0,"transitiontime":4}
16:46:59 T:2810977088  NOTICE: XBMC Hue: DEBUG set_light: 5: {"on":false}
16:46:59 T:2810977088   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: ('hue',)
                                            Traceback (most recent call last):
                                              File "/storage/.xbmc/addons/script.xbmc.hue.ambilight-master/default.py", line 454, in <module>
                                                hue = Hue(settings, args)
                                              File "/storage/.xbmc/addons/script.xbmc.hue.ambilight-master/default.py", line 119, in __init__
                                                self.flash_lights()
                                              File "/storage/.xbmc/addons/script.xbmc.hue.ambilight-master/default.py", line 126, in flash_lights
                                                self.light[0].flash_light()
                                              File "/storage/.xbmc/addons/script.xbmc.hue.ambilight-master/resources/lib/tools.py", line 160, in flash_light
                                                self.brighter_light()
                                              File "/storage/.xbmc/addons/script.xbmc.hue.ambilight-master/resources/lib/tools.py", line 181, in brighter_light
                                                data += ',"hue":%s' % self.start_setting['hue']
                                            KeyError: ('hue',)
                                            -->End of Python script error report<--

Version: 0.6.0 Settings:

    <setting id="ambilight_dim" value="false" />
    <setting id="ambilight_dim_group" value="0" />
    <setting id="ambilight_info" value="" />
    <setting id="ambilight_max" value="100" />
    <setting id="ambilight_min" value="50" />
    <setting id="bridge_ip" value="192.168.178.xxx" />
    <setting id="bridge_user" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
    <setting id="color_bias" value="36" />
    <setting id="debug" value="true" />
    <setting id="dimmed_bri" value="50" />
    <setting id="dimmed_hue" value="22755" />
    <setting id="discover_bridge" value="" />
    <setting id="group_id" value="0" />
    <setting id="light" value="1" />
    <setting id="light1_id" value="5" />
    <setting id="light2_id" value="2" />
    <setting id="light3_id" value="3" />
    <setting id="misc_initialflash" value="false" />
    <setting id="mode" value="1" />
    <setting id="override_hue" value="false" />
    <setting id="override_undim_bri" value="true" />
    <setting id="undim_bri" value="75" />
    <setting id="undim_hue" value="22755" />
tetzlav commented 10 years ago

Ah, i found https://github.com/cees-elzinga/script.xbmc.hue.ambilight/issues/15 But if i disable initial flashing the script dims the light, but after stopping playback it does not undim and i get

17:11:34 T:2971519808  NOTICE: XBMC Hue: DEBUG state changed to: stopped
17:11:34 T:2971519808  NOTICE: XBMC Hue: DEBUG class Hue: brighter lights
17:11:34 T:2753579840  NOTICE: Thread BackgroundLoader start, auto delete: false
17:11:34 T:3018188544  NOTICE: CDVDPlayer::CloseFile()
17:11:34 T:3018188544 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
17:11:34 T:3018188544  NOTICE: DVDPlayer: waiting for threads to exit
17:11:34 T:3018188544  NOTICE: DVDPlayer: finished waiting
17:11:34 T:2971519808   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: ('hue',)
                                            Traceback (most recent call last):
                                              File "/storage/.xbmc/addons/script.xbmc.hue.ambilight-master/default.py", line 70, in onPlayBackStopped
                                                state_changed("stopped")
                                              File "/storage/.xbmc/addons/script.xbmc.hue.ambilight-master/default.py", line 443, in state_changed
                                                hue.brighter_lights()
                                              File "/storage/.xbmc/addons/script.xbmc.hue.ambilight-master/default.py", line 170, in brighter_lights
                                                self.light[0].brighter_light()
                                              File "/storage/.xbmc/addons/script.xbmc.hue.ambilight-master/resources/lib/tools.py", line 181, in brighter_light
                                                data += ',"hue":%s' % self.start_setting['hue']
                                            KeyError: ('hue',)
                                            -->End of Python script error report<--
17:11:34 T:2770365248  NOTICE: Thread Jobworker start, auto delete: true
cees-elzinga commented 10 years ago

This should be fixed in version 0.6.1.

(The bug is in the "brighter_lights" function that did not check if the bulb was a LW bulb. In issue #15 it showed when flashing the lights, and in this case when playback stops, but it's the same code triggering the error)

Please try again with version 0.6.1 and let me know if I can close the issue.

tetzlav commented 10 years ago

YES, it works now with version 0.6.1! Thank you a lot for fast fixing this bug.