From a8263c9d390340307ca1333822ab1ad285a86c6f Mon Sep 17 00:00:00 2001 From: petretiandrea Date: Sat, 12 Feb 2022 13:06:47 +0000 Subject: [PATCH 1/3] removed color warm for L900 --- custom_components/tapo/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/tapo/const.py b/custom_components/tapo/const.py index 36ec485..c2331e8 100755 --- a/custom_components/tapo/const.py +++ b/custom_components/tapo/const.py @@ -13,7 +13,7 @@ SUPPORTED_DEVICE_AS_SWITCH = ["p100", "p105", "p110"] SUPPORTED_DEVICE_AS_SWITCH_POWER_MONITOR = ["p110"] SUPPORTED_DEVICE_AS_LIGHT = { - "l900": SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP | SUPPORT_COLOR, + "l900": SUPPORT_BRIGHTNESS | SUPPORT_COLOR, "l530": SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP | SUPPORT_COLOR, "l510": SUPPORT_BRIGHTNESS, } From 2d15887793c0d7a640685e599951da81ffde867e Mon Sep 17 00:00:00 2001 From: petretiandrea Date: Sat, 12 Feb 2022 13:11:07 +0000 Subject: [PATCH 2/3] fix l530 wrong color change --- custom_components/tapo/light.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/custom_components/tapo/light.py b/custom_components/tapo/light.py index bc25e09..d2f9158 100755 --- a/custom_components/tapo/light.py +++ b/custom_components/tapo/light.py @@ -84,7 +84,7 @@ def hs_color(self): @property def color_temp(self): color_temp = self._tapo_coordinator.data.color_temp - if color_temp: + if color_temp and color_temp > 0: return kelvin_to_mired(color_temp) @property @@ -146,6 +146,11 @@ async def _change_color_temp(self, color_temp): async def _change_color(self, hs_color): _LOGGER.info(f"Mapped colors: {hs_color}") + # L530 device need to set color_temp to 0 before set hue and saturation. + # When color_temp > 0 the device will ignore any hue and saturation value + await self._execute_with_fallback( + lambda: self._tapo_coordinator.api.set_color_temperature(0) + ) await self._execute_with_fallback( lambda: self._tapo_coordinator.api.set_hue_saturation( hs_color[0], hs_color[1] From 861c4d5006060148209914c5795771b0413b8ef9 Mon Sep 17 00:00:00 2001 From: petretiandrea Date: Sat, 12 Feb 2022 13:16:31 +0000 Subject: [PATCH 3/3] fix to handle L900 warm case --- custom_components/tapo/light.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/tapo/light.py b/custom_components/tapo/light.py index d2f9158..ddeb15c 100755 --- a/custom_components/tapo/light.py +++ b/custom_components/tapo/light.py @@ -148,9 +148,10 @@ async def _change_color(self, hs_color): _LOGGER.info(f"Mapped colors: {hs_color}") # L530 device need to set color_temp to 0 before set hue and saturation. # When color_temp > 0 the device will ignore any hue and saturation value - await self._execute_with_fallback( - lambda: self._tapo_coordinator.api.set_color_temperature(0) - ) + if self.supported_features & SUPPORT_COLOR_TEMP: + await self._execute_with_fallback( + lambda: self._tapo_coordinator.api.set_color_temperature(0) + ) await self._execute_with_fallback( lambda: self._tapo_coordinator.api.set_hue_saturation( hs_color[0], hs_color[1]