Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.1.1 AttributeError: 'NoneType' object has no attribute 'hue' Tapo L530 Series bulbs #746

Open
m-reed-2023 opened this issue Apr 15, 2024 · 3 comments · May be fixed by #748
Open

3.1.1 AttributeError: 'NoneType' object has no attribute 'hue' Tapo L530 Series bulbs #746

m-reed-2023 opened this issue Apr 15, 2024 · 3 comments · May be fixed by #748

Comments

@m-reed-2023
Copy link

Version of the integration

3.1.1

Configuration

Tapo L530 (Colour Bulb)
Hardware Version 1.0
Firmware 1.3.0

Home Assistant Green Running:
Core 2024.4.3
Supervisor 2024.04.0
Operating System 12.2
Frontend 20240404.2

2024-04-15 09:32:33.516 ERROR (MainThread) [homeassistant.components.light] Error adding entity light.dryer_lamp for domain light with platform tapo
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 890, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1334, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:32:33.642 ERROR (MainThread) [custom_components.tapo.coordinators] Tapo exception: Returned unknown error_code: -1402  msg: curr ver:1.5.5 Build 20230927 Rel. 40646, cloud ver:.
2024-04-15 09:32:33.643 ERROR (MainThread) [custom_components.tapo.coordinators] Error fetching tapo data: Error tapo exception: Returned unknown error_code: -1402  msg: curr ver:1.5.5 Build 20230927 Rel. 40646, cloud ver:.
2024-04-15 09:32:33.643 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.871 seconds (success: False)
2024-04-15 09:32:33.677 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.942 seconds (success: True)
2024-04-15 09:32:33.706 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.600 seconds (success: True)
2024-04-15 09:32:33.717 ERROR (MainThread) [homeassistant.components.light] Error adding entity light.bookcase_lamp for domain light with platform tapo
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 890, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1334, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'

Describe the bug

After updating to 3.1.1 some of my Tapo L530 bulbs fail to initialise and others that can be controlled form the dashboard are producing a "Failed to call service light/turn_on. 'NoneType' object has no attribute 'hue'" error which causes automations using these lights to fail.

Debug log


2024-04-15 09:31:33.822 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration alexa_media which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-04-15 09:31:33.826 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-04-15 09:31:33.830 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration tapo which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-04-15 09:31:45.559 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'hacs' accesses hass.components.frontend. This is deprecated and will stop working in Home Assistant 2024.9, it should be updated to import functions used from frontend directly at custom_components/hacs/frontend.py, line 68: hass.components.frontend.async_register_built_in_panel(, please create a bug report at https://github.com/hacs/integration/issues
2024-04-15 09:31:57.705 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'alexa_media' calls `async_add_job`, which is deprecated and will be removed in Home Assistant 2025.4; Please review https://developers.home-assistant.io/blog/2024/03/13/deprecate_add_run_job for replacement options at custom_components/alexa_media/__init__.py, line 625: hass.async_add_job(, please create a bug report at https://github.com/alandtse/alexa_media_player/issues
2024-04-15 09:32:02.631 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'alexa_media' calls `async_add_job`, which is deprecated and will be removed in Home Assistant 2025.4; Please review https://developers.home-assistant.io/blog/2024/03/13/deprecate_add_run_job for replacement options at custom_components/alexa_media/media_player.py, line 188: hass.async_add_job(, please create a bug report at https://github.com/alandtse/alexa_media_player/issues
2024-04-15 09:32:29.009 DEBUG (MainThread) [custom_components.tapo] Migrating from version 8
2024-04-15 09:32:29.164 DEBUG (MainThread) [custom_components.tapo] Migrating from version 8
2024-04-15 09:32:29.260 DEBUG (MainThread) [custom_components.tapo] Migrating from version 8
2024-04-15 09:32:29.366 DEBUG (MainThread) [custom_components.tapo] Migrating from version 8
2024-04-15 09:32:29.475 DEBUG (MainThread) [custom_components.tapo] Migrating from version 8
2024-04-15 09:32:29.551 DEBUG (MainThread) [custom_components.tapo] Migrating from version 8
2024-04-15 09:32:29.631 DEBUG (MainThread) [custom_components.tapo] Migrating from version 8
2024-04-15 09:32:29.720 DEBUG (MainThread) [custom_components.tapo] Migrating from version 8
2024-04-15 09:32:29.834 DEBUG (MainThread) [custom_components.tapo] Migrating from version 8
2024-04-15 09:32:29.931 DEBUG (MainThread) [custom_components.tapo] Migrating from version 8
2024-04-15 09:32:30.037 DEBUG (MainThread) [custom_components.tapo] Migrating from version 8
2024-04-15 09:32:30.121 DEBUG (MainThread) [custom_components.tapo] Migrating from version 8
2024-04-15 09:32:31.974 INFO (MainThread) [custom_components.tapo.hass_tapo] Detected model of 192.168.1.253: P100
2024-04-15 09:32:32.021 INFO (MainThread) [custom_components.tapo.hass_tapo] Detected model of 192.168.1.103: P100
2024-04-15 09:32:32.039 INFO (MainThread) [custom_components.tapo.hass_tapo] Detected model of 192.168.1.105: P100
2024-04-15 09:32:32.273 INFO (MainThread) [custom_components.tapo.hass_tapo] Detected model of 192.168.1.178: L530 Series
2024-04-15 09:32:32.409 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.434 seconds (success: True)
2024-04-15 09:32:32.568 INFO (MainThread) [custom_components.tapo.hass_tapo] Detected model of 192.168.1.198: P110
2024-04-15 09:32:32.577 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.555 seconds (success: True)
2024-04-15 09:32:32.580 INFO (MainThread) [custom_components.tapo.hass_tapo] Detected model of 192.168.1.96: P110
2024-04-15 09:32:32.595 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.555 seconds (success: True)
2024-04-15 09:32:32.609 INFO (MainThread) [custom_components.tapo.hass_tapo] Detected model of 192.168.1.245: P110
2024-04-15 09:32:32.642 INFO (MainThread) [custom_components.tapo.hass_tapo] Detected model of 192.168.1.237: P110
2024-04-15 09:32:32.808 INFO (MainThread) [custom_components.tapo.hass_tapo] Detected model of 192.168.1.173: L530 Series
2024-04-15 09:32:32.907 INFO (MainThread) [custom_components.tapo.hass_tapo] Detected model of 192.168.1.99: L530 Series
2024-04-15 09:32:32.985 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.712 seconds (success: True)
2024-04-15 09:32:33.007 INFO (MainThread) [custom_components.tapo.hass_tapo] Detected model of 192.168.1.218: L530 Series
2024-04-15 09:32:33.105 INFO (MainThread) [custom_components.tapo.hass_tapo] Detected model of 192.168.1.246: L530 Series
2024-04-15 09:32:33.358 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.549 seconds (success: True)
2024-04-15 09:32:33.428 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.520 seconds (success: True)
2024-04-15 09:32:33.503 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.496 seconds (success: True)
2024-04-15 09:32:33.516 ERROR (MainThread) [homeassistant.components.light] Error adding entity light.dryer_lamp for domain light with platform tapo
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 890, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1334, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:32:33.642 ERROR (MainThread) [custom_components.tapo.coordinators] Tapo exception: Returned unknown error_code: -1402  msg: curr ver:1.5.5 Build 20230927 Rel. 40646, cloud ver:.
2024-04-15 09:32:33.643 ERROR (MainThread) [custom_components.tapo.coordinators] Error fetching tapo data: Error tapo exception: Returned unknown error_code: -1402  msg: curr ver:1.5.5 Build 20230927 Rel. 40646, cloud ver:.
2024-04-15 09:32:33.643 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.871 seconds (success: False)
2024-04-15 09:32:33.677 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.942 seconds (success: True)
2024-04-15 09:32:33.706 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.600 seconds (success: True)
2024-04-15 09:32:33.717 ERROR (MainThread) [homeassistant.components.light] Error adding entity light.bookcase_lamp for domain light with platform tapo
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 890, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1334, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:32:33.824 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.255 seconds (success: True)
2024-04-15 09:32:33.858 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.248 seconds (success: True)
2024-04-15 09:32:33.898 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.255 seconds (success: True)
2024-04-15 09:32:33.930 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.349 seconds (success: True)
2024-04-15 09:32:34.027 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.266 seconds (success: True)
2024-04-15 09:32:34.048 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.292 seconds (success: True)
2024-04-15 09:32:34.222 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.235 seconds (success: True)
2024-04-15 09:32:34.325 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.326 seconds (success: True)
2024-04-15 09:32:34.431 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.926 seconds (success: True)
2024-04-15 09:32:34.437 ERROR (MainThread) [homeassistant.components.sensor] tapo: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 707, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1268, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 532, in async_update
    await self.coordinator.async_request_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in async_request_refresh
    await self._debounced_refresh.async_call()
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 117, in async_call
    await task
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 291, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/tapo/entity.py", line 45, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:32:34.523 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.980 seconds (success: True)
2024-04-15 09:32:34.631 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.708 seconds (success: True)
2024-04-15 09:32:34.664 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.709 seconds (success: True)
2024-04-15 09:32:34.681 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.800 seconds (success: True)
2024-04-15 09:32:34.691 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.842 seconds (success: True)
2024-04-15 09:32:34.695 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.265 seconds (success: True)
2024-04-15 09:32:34.818 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.373 seconds (success: True)
2024-04-15 09:32:34.882 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.982 seconds (success: True)
2024-04-15 09:32:34.897 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.190 seconds (success: True)
2024-04-15 09:32:34.903 ERROR (MainThread) [homeassistant.components.sensor] tapo: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 707, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1268, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 532, in async_update
    await self.coordinator.async_request_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in async_request_refresh
    await self._debounced_refresh.async_call()
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 117, in async_call
    await task
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 291, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/tapo/entity.py", line 45, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:32:34.929 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.997 seconds (success: True)
2024-04-15 09:32:34.937 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.078 seconds (success: True)
2024-04-15 09:32:34.948 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.122 seconds (success: True)
2024-04-15 09:32:35.014 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.280 seconds (success: True)
2024-04-15 09:32:35.032 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.672 seconds (success: True)
2024-04-15 09:32:35.097 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.725 seconds (success: True)
2024-04-15 09:32:38.431 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: {('tapo', 'd342b17f62de68adff55f91655d72955'): 110.033682715}
2024-04-15 09:32:39.411 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 6.636 seconds (success: True)
2024-04-15 09:32:39.476 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 6.691 seconds (success: True)
2024-04-15 09:32:57.947 INFO (MainThread) [custom_components.tapo.light] Setting brightness: None, tapo None
2024-04-15 09:32:57.947 INFO (MainThread) [custom_components.tapo.light] Setting color: None, tapo None
2024-04-15 09:32:57.948 INFO (MainThread) [custom_components.tapo.light] Setting color_temp: None, tapo None
2024-04-15 09:32:57.948 INFO (MainThread) [custom_components.tapo.light] Setting effect: None
2024-04-15 09:32:58.165 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [281472325503296] Returned error_code: TapoError.ERR_DEVICE: Rate limit exceeded
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 631, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/config/custom_components/tapo/light.py", line 127, in async_turn_on
    await self._set_state(
  File "/config/custom_components/tapo/light.py", line 154, in _set_state
    (await self.device.turn_on()).get_or_raise()
  File "/usr/local/lib/python3.12/site-packages/plugp100/common/functional/tri.py", line 159, in get_or_raise
    raise self.value
plugp100.responses.tapo_exception.TapoException: Returned error_code: TapoError.ERR_DEVICE: Rate limit exceeded
2024-04-15 09:33:02.315 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.160 seconds (success: True)
2024-04-15 09:33:03.937 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.137 seconds (success: True)
2024-04-15 09:33:04.032 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.222 seconds (success: True)
2024-04-15 09:33:04.033 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/tapo/entity.py", line 45, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:33:04.049 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.177 seconds (success: True)
2024-04-15 09:33:04.225 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.229 seconds (success: True)
2024-04-15 09:33:05.051 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.362 seconds (success: True)
2024-04-15 09:33:05.171 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.368 seconds (success: True)
2024-04-15 09:33:05.244 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.408 seconds (success: True)
2024-04-15 09:33:05.288 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.397 seconds (success: True)
2024-04-15 09:33:05.305 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.278 seconds (success: True)
2024-04-15 09:33:05.317 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/tapo/entity.py", line 45, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:33:05.379 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.293 seconds (success: True)
2024-04-15 09:33:09.068 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.150 seconds (success: True)
2024-04-15 09:33:32.080 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.185 seconds (success: True)
2024-04-15 09:33:32.391 DEBUG (MainThread) [custom_components.tapo] Migrating from version 8
2024-04-15 09:33:33.135 INFO (MainThread) [custom_components.tapo.hass_tapo] Detected model of 192.168.1.246: L530 Series
2024-04-15 09:33:33.301 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.165 seconds (success: True)
2024-04-15 09:33:33.313 ERROR (MainThread) [homeassistant.components.light] Error adding entity light.bookcase_lamp for domain light with platform tapo
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 890, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1334, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:33:33.932 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.132 seconds (success: True)
2024-04-15 09:33:34.027 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.217 seconds (success: True)
2024-04-15 09:33:34.029 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/tapo/entity.py", line 45, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:33:34.045 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.173 seconds (success: True)
2024-04-15 09:33:34.256 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.255 seconds (success: True)
2024-04-15 09:33:34.545 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.242 seconds (success: True)
2024-04-15 09:33:34.549 ERROR (MainThread) [homeassistant.components.sensor] tapo: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 707, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1268, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 532, in async_update
    await self.coordinator.async_request_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in async_request_refresh
    await self._debounced_refresh.async_call()
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 117, in async_call
    await task
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 291, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/tapo/entity.py", line 45, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:33:34.630 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 1.302 seconds (success: True)
2024-04-15 09:33:35.047 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.357 seconds (success: True)
2024-04-15 09:33:35.161 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.355 seconds (success: True)
2024-04-15 09:33:35.203 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.368 seconds (success: True)
2024-04-15 09:33:35.251 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.359 seconds (success: True)
2024-04-15 09:33:35.339 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.256 seconds (success: True)
2024-04-15 09:33:39.068 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.149 seconds (success: True)
2024-04-15 09:34:02.082 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.186 seconds (success: True)
2024-04-15 09:34:03.934 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.133 seconds (success: True)
2024-04-15 09:34:04.042 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.232 seconds (success: True)
2024-04-15 09:34:04.043 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/tapo/entity.py", line 45, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:34:04.060 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.188 seconds (success: True)
2024-04-15 09:34:04.163 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.217 seconds (success: True)
2024-04-15 09:34:04.164 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/tapo/entity.py", line 45, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:34:04.331 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.333 seconds (success: True)
2024-04-15 09:34:05.035 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.346 seconds (success: True)
2024-04-15 09:34:05.162 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.359 seconds (success: True)
2024-04-15 09:34:05.258 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.367 seconds (success: True)
2024-04-15 09:34:05.266 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.184 seconds (success: True)
2024-04-15 09:34:05.405 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.570 seconds (success: True)
2024-04-15 09:34:09.070 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.152 seconds (success: True)
2024-04-15 09:34:32.085 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.188 seconds (success: True)
2024-04-15 09:34:33.940 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.139 seconds (success: True)
2024-04-15 09:34:34.045 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.235 seconds (success: True)
2024-04-15 09:34:34.046 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/tapo/entity.py", line 45, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:34:34.064 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.192 seconds (success: True)
2024-04-15 09:34:34.151 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.205 seconds (success: True)
2024-04-15 09:34:34.154 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/tapo/entity.py", line 45, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:34:34.245 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.246 seconds (success: True)
2024-04-15 09:34:35.043 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.354 seconds (success: True)
2024-04-15 09:34:35.173 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.372 seconds (success: True)
2024-04-15 09:34:35.204 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.366 seconds (success: True)
2024-04-15 09:34:35.264 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.182 seconds (success: True)
2024-04-15 09:34:35.281 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.386 seconds (success: True)
2024-04-15 09:34:39.054 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.136 seconds (success: True)
2024-04-15 09:35:02.088 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.192 seconds (success: True)
2024-04-15 09:35:03.954 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.153 seconds (success: True)
2024-04-15 09:35:04.063 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.253 seconds (success: True)
2024-04-15 09:35:04.065 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/tapo/entity.py", line 45, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:35:04.080 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.208 seconds (success: True)
2024-04-15 09:35:04.165 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.218 seconds (success: True)
2024-04-15 09:35:04.166 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/tapo/entity.py", line 45, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1058, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1191, in state_attributes
    color_mode = self._light_internal_color_mode if _is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 911, in _light_internal_color_mode
    if (color_mode := self.color_mode) is None:
                      ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 63, in color_mode
    if ColorMode.HS in self.supported_color_modes and self.hs_color is not None:
                                                      ^^^^^^^^^^^^^
  File "/config/custom_components/tapo/light.py", line 84, in hs_color
    (hue, saturation) = (self.device.hs.hue, self.device.hs.saturation)
                         ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hue'
2024-04-15 09:35:04.254 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.257 seconds (success: True)
2024-04-15 09:35:05.039 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.348 seconds (success: True)
2024-04-15 09:35:05.161 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.358 seconds (success: True)
2024-04-15 09:35:05.191 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.352 seconds (success: True)
2024-04-15 09:35:05.273 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.380 seconds (success: True)
2024-04-15 09:35:05.348 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.266 seconds (success: True)
2024-04-15 09:35:09.060 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.142 seconds (success: True)

@viprapp
Copy link

viprapp commented Apr 15, 2024

Got this too. This currently breaks a lot of things for me.

cbrand added a commit to cbrand/home-assistant-tapo-p100 that referenced this issue Apr 16, 2024
Avoid a crash on the hs light check if none is set.

Fixes petretiandrea#746
cbrand added a commit to cbrand/home-assistant-tapo-p100 that referenced this issue Apr 16, 2024
Avoid a crash on the hs light check if none is set.

Fixes petretiandrea#746
@cbrand cbrand linked a pull request Apr 16, 2024 that will close this issue
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label May 16, 2024
@serin113
Copy link

(original comment: #757 (comment), reposting so the issue doesn't go stale)


I tried reverting to earlier versions to trace where this issue started: v3.0.0 doesn't have it, but v3.1.0 and above do.

#748 fixes this specific issue, since the recently introduced new interface does allow the hs object to be none: https://github.com/petretiandrea/plugp100/blob/0c092b33e233b7881188b05e9b01f967e043ca8b/plugp100/new/components/light_component.py#L41

    @property
    def hs(self) -> Optional[HS]:
        if self._state.hue is not None and self._state.saturation is not None:
            return HS(self._state.hue, self._state.saturation)
        return None

Why the L530E (v1.0) doesn't have hue & saturation isn't obvious to me, but it's the exact same issue I have with the default Tapo integration (home-assistant/core#111757). I'm guessing this issue was introduced by a recent firmware update, because even reverting to a previously working version of this integration didn't fix the color+brightness resetting.

The python-kasa project has recently merged a fix for this exact model, maybe it'll help with the new interface (but it's not in a release yet): python-kasa/python-kasa#840

@github-actions github-actions bot removed the stale label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants