Closed BoredMind closed 1 year ago
@brg468 can you look at this issue? Is it related to your recent PR?
@SecKatie it must be based on the timing. I was under the impression that all bulbs reported the color mode property, but apparently the early ones might not. I’ll take a look.
@BoredMind if you would like to try this before it gets merged to make sure it actually fixes the problem, you can edit your light.py file starting at line 219 like below.
The bulbs are now active again, and while I can turn them on and off, I get this error when it happens:
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/wyzeapi/light.py:221
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 4:09:28 PM (3 occurrences)
Last logged: 4:09:38 PM
[547493361856] 'Bulb' object has no attribute 'color_mode'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
return await service.entity_service_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call
response_data = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 580, in async_handle_light_on_service
await light.async_turn_on(**filter_turn_on_params(light, params))
File "/config/custom_components/wyzeapi/token_manager.py", line 45, in inner_function
await func(*args, **kwargs)
File "/config/custom_components/wyzeapi/light.py", line 201, in async_turn_on
self.async_schedule_update_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 903, in async_schedule_update_ha_state
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 746, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 810, in _async_write_ha_state
attr.update(self.state_attributes or {})
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 996, in state_attributes
color_mode = self._light_internal_color_mode
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 822, in _light_internal_color_mode
if (color_mode := self.color_mode) is None:
^^^^^^^^^^^^^^^
File "/config/custom_components/wyzeapi/light.py", line 221, in color_mode
if self._bulb.type is DeviceTypes.LIGHT:
^^^^^^^^^^^^
AttributeError: 'Bulb' object has no attribute 'color_mode'
Did a full restart of HA, might not be seeing that error any longer, the "AttributeError: 'Bulb' object has no attribute 'color_mode'" one
So all good?
So all good?
Appears to be all good
@BoredMind if you would like to try this before it gets merged to make sure it actually fixes the problem, you can edit your light.py file starting at line 219 like below.
I can confirm this works for me after a restart
@1h8fulkat you modified the code as above? 0.1.22 does not incorporate this change unless you made it yourself.
@1h8fulkat you modified the code as above? 0.1.22 does not incorporate this change unless you made it yourself.
I retract my previous statement 🤦♂️
Updating light.py fixed it for me
Just completed the change and restarted HA. No more error.
Just ran into this issue, or at least realized I was running into this issue. Found the open bug with workaround and am happy to report that after adjusting the code it fixed the issue here as well. Thank you!
Is there ever going to be a release containing this PR? Seems crazy to put out a release that breaks bulbs and not put out another release with the fix. Having folks fix the file manually is absurd.
@nicksardo, while I would like to see this get merged at well, let’s remember that this integration is totally built and maintained by volunteers in their spare time. Until the update is pushed, I gave you a simple copy and paste fix that you can choose to use or not.
This is my first attempt to edit code. I applied the above and it worked for the first 3 of my 7 bulbs. The other 4 are still showing Unavailable status. Any advice?
Logger: wyzeapy.services.update_manager Source: /usr/local/lib/python3.11/site-packages/wyzeapy/services/update_manager.py:46 First occurred: 12:13:12 AM (1 occurrences) Last logged: 12:13:12 AM
Unknown error happened during updating device info Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/wyzeapy/services/update_manager.py", line 44, in update self.device.callback_function(self.device) File "/config/custom_components/wyzeapi/light.py", line 353, in async_update_callback self.async_schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 956, in async_schedule_update_ha_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state state, attr = self._async_generate_attributes() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 822, in _async_generate_attributes attr.update(self.state_attributes or {}) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 1007, in state_attributes color_mode = self._light_internal_color_mode ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 833, in _light_internal_color_mode if (color_mode := self.color_mode) is None: ^^^^^^^^^^^^^^^ File "/config/custom_components/wyzeapi/light.py", line 221, in color_mode return ColorMode.COLOR_TEMP if self._bulb.color_mode == "2" else ColorMode.HS ^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Bulb' object has no attribute 'color_mode'
Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:226 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 12:13:00 AM (1 occurrences) Last logged: 12:13:00 AM
[140066697070528] 'Bulb' object has no attribute 'color_mode' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 2012, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2049, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 580, in async_handle_light_on_service await light.async_turn_on(*filter_turn_on_params(light, params)) File "/config/custom_components/wyzeapi/token_manager.py", line 45, in inner_function await func(args, **kwargs) File "/config/custom_components/wyzeapi/light.py", line 201, in async_turn_on self.async_schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 956, in async_schedule_update_ha_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state state, attr = self._async_generate_attributes() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 822, in _async_generate_attributes attr.update(self.state_attributes or {}) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 1007, in state_attributes color_mode = self._light_internal_color_mode ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 833, in _light_internal_color_mode if (color_mode := self.color_mode) is None: ^^^^^^^^^^^^^^^ File "/config/custom_components/wyzeapi/light.py", line 221, in color_mode return ColorMode.COLOR_TEMP if self._bulb.color_mode == "2" else ColorMode.HS ^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Bulb' object has no attribute 'color_mode'
@James62370 I'm guessing something didn't go right when you edited the code since the error still refers to the "if" statement on line 221. I posted an easier way to correct this problem here:
https://github.com/SecKatie/ha-wyzeapi/issues/521#issuecomment-1757428836
@James62370 I'm guessing something didn't go right when you edited the code since the error still refers to the "if" statement on line 221. I posted an easier way to correct this problem here:
Thanks for pointing me to the right location. I downloaded the updated script and appears to be working well now.
Describe the bug Non color Wyze bulbs, pre-2019 bulbs, do not load any longer. Started a few days ago.
To Reproduce Steps to reproduce the behavior:
This entity is no longer being provided by the wyzeapi integration. If the entity is no longer in use, delete it in settings.
Expected behavior Should be able to control bulb, cannot change any attributes.
System configuration HA Version: 2023.8. WyzeApi Version: 0.1.22
Device info WLPA19 by WyzeLabs
home-assistant.log