From 9ca3efb161868e4a4253b166d9ea65aa4e1a9e0a Mon Sep 17 00:00:00 2001 From: ultratoto14 Date: Tue, 17 Nov 2020 08:42:39 +0100 Subject: [PATCH] Fix brightness issues. --- custom_components/localtuya/light.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/localtuya/light.py b/custom_components/localtuya/light.py index 2881989..2a77a27 100644 --- a/custom_components/localtuya/light.py +++ b/custom_components/localtuya/light.py @@ -311,6 +311,7 @@ class LocaltuyaLight(LocalTuyaEntity, LightEntity): round(self._hs[0]), round(self._hs[1] * 10.0), brightness ) states[self._config.get(CONF_COLOR)] = color + states[self._config.get(CONF_COLOR_MODE)] = COLOR_MODE if ATTR_HS_COLOR in kwargs and (features & SUPPORT_COLOR): if brightness is None: @@ -362,7 +363,7 @@ class LocaltuyaLight(LocalTuyaEntity, LightEntity): if supported & SUPPORT_COLOR: color = self.dps_conf(CONF_COLOR) - if color is not None: + if color is not None and not self.__is_white_mode(): if self.__is_color_rgb_encoded(): hue = int(color[6:10], 16) sat = int(color[10:12], 16)