jomwells / ambilights

Custom Home Assistant (Light) Component for Ambilight LED's on Philips Android TV's
48 stars 20 forks source link

Update light.py #19

Open chpego opened 3 years ago

chpego commented 3 years ago
Verguldebarman commented 3 years ago

Tried a manual update of light.py. Lot's of errors unfortunattely. See below:

2020-11-21 12:48:06 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.tv_ambilight fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update raise exc File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/philips_ambilight/light.py", line 280, in update self.getState() File "/config/custom_components/philips_ambilight/light.py", line 197, in getState effect = fullstate['menuSetting'] KeyError: 'menuSetting' 2020-11-21 12:48:08 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.tv_ambilight fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update raise exc File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/philips_ambilight/light.py", line 280, in update self.getState() File "/config/custom_components/philips_ambilight/light.py", line 197, in getState effect = fullstate['menuSetting'] KeyError: 'menuSetting' 2020-11-21 12:48:10 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [1892763560] 'NoneType' object is not subscriptable Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1451, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1486, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 499, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 536, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 699, in async_turn_off await self.hass.async_add_executor_job(ft.partial(self.turn_off, **kwargs)) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/philips_ambilight/light.py", line 186, in turn_off OLD_STATE = [self._hs[0], self._hs[1], self._brightness, self._effect] TypeError: 'NoneType' object is not subscriptable 2020-11-21 12:48:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.tv_ambilight fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update raise exc File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/philips_ambilight/light.py", line 280, in update self.getState() File "/config/custom_components/philips_ambilight/light.py", line 197, in getState effect = fullstate['menuSetting'] KeyError: 'menuSetting' 2020-11-21 12:48:16 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.tv_ambilight fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update raise exc File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/philips_ambilight/light.py", line 280, in update self.getState() File "/config/custom_components/philips_ambilight/light.py", line 197, in getState effect = fullstate['menuSetting'] KeyError: 'menuSetting' 2020-11-21 12:48:21 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/google_assistant/report_state.py", line 49, in async_entity_state_listener if entity_data == old_entity.query_serialize(): File "/usr/src/homeassistant/homeassistant/components/google_assistant/helpers.py", line 489, in query_serialize deep_update(attrs, trt.query_attributes()) File "/usr/src/homeassistant/homeassistant/components/google_assistant/trait.py", line 404, in query_attributes "value": brightness / 255, TypeError: unsupported operand type(s) for /: 'NoneType' and 'int' 2020-11-21 12:48:24 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.tv_ambilight fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update raise exc File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/philips_ambilight/light.py", line 280, in update self.getState() File "/config/custom_components/philips_ambilight/light.py", line 197, in getState effect = fullstate['menuSetting'] KeyError: 'menuSetting' 2020-11-21 12:48:26 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [1892763560] 'NoneType' object is not subscriptable Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1451, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1486, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 499, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 536, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 230, in async_handle_light_on_service await light.async_turn_on(**params) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 690, in async_turn_on await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs)) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/philips_ambilight/light.py", line 168, in turn_on "colorSettings":{"color":{"hue":int(self._hs[0]*(255/360)),"saturation":int(self._hs[1]*(255/100)), TypeError: 'NoneType' object is not subscriptable 2020-11-21 12:48:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.tv_ambilight fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update raise exc File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/philips_ambilight/light.py", line 280, in update self.getState() File "/config/custom_components/philips_ambilight/light.py", line 197, in getState effect = fullstate['menuSetting'] KeyError: 'menuSetting' 2020-11-21 12:48:33 WARNING (MainThread) [homeassistant.components.device_tracker] Updating device list from legacy took longer than the scheduled scan interval 0:00:12

iTacco commented 3 years ago

Thank you very much. It fixed the bug. I can change the manual colors again.

But its still not perfect. Some displaying bugs inside HomeAssistant. I am changing the mode to "Party" for example. The TV changes the mode aswell. But Homeassistant displaying the mode I set manually on the TV before.

An other bug, the mode "Warm White" not working at all.

EFFECT_LL_HOT_LAVA = "Hot Lava"
EFFECT_LL_DEEP_WATER = "Deep Water"
EFFECT_LL_FRESH_NATURE = "Fresh Nature"

These three modes changing the color on the TV but I am getting an error popup inside HomeAssistant. Error message: "Error when calling the service light/turn_on. name 'false' is not defined"

chpego commented 3 years ago

Thank's @iTacco @LineC0der ;) I'm not a Python developer but i think we can find why there is some trouble in the code 👍