Closed Cynopolis closed 1 year ago
Please see https://github.com/SecKatie/ha-wyzeapi/issues/504.
This has been corrected, an updated version will fix it but if you want to do a tiny bit of editing the fix is in the comments.
Yes those two lines of code fixed the issue! I'll close out this issue.
Describe the bug When sending any command to a Wyze 2019 bulb I get the error stated in the title. I can manually set the brightness of the lights, but they do not respond when I send an off command. If the light is being controlled by an automation script, the error crashes the script immediately and it will not finish.
To Reproduce
Expected behavior No error should occur and the light should be able to be turned off as intended.
System configuration System: Raspberry Pi 4 using the premade HA OS image. HA Version: 2023.8.1 Supervisor: 2023.07.1 Operating System: 10.4 WyzeApi Version: 0.1.22
home-assistant.log
Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/wyzeapi/light.py:221 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 6:30:36 PM (70 occurrences) Last logged: 7:34:01 PM
[548111405120] 'Bulb' object has no attribute 'color_mode' [548023060800] 'Bulb' object has no attribute 'color_mode' [547979615680] Error handling message: Unknown error (unknown_error) Quinn from 10.0.0.185 (Mozilla/5.0 (Linux; Android 12; HD1907 Build/SKQ1.220303.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/115.0.5790.138 Mobile Safari/537.36 Home Assistant/2023.7.5-10506 (Android 12; HD1907)) [548051787328] '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 return ColorMode.COLOR_TEMP if self._bulb.color_mode == "2" else ColorMode.HS ^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Bulb' object has no attribute 'color_mode'