From d84062e2a173cbc6b7e245993549faa05fbfd697 Mon Sep 17 00:00:00 2001 From: ultratoto14 Date: Wed, 4 Nov 2020 16:31:04 +0100 Subject: [PATCH] Use default home assistant behavior. Return only relevant data per mode. --- custom_components/localtuya/light.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/custom_components/localtuya/light.py b/custom_components/localtuya/light.py index fbd67cdb3..96bc5bad9 100644 --- a/custom_components/localtuya/light.py +++ b/custom_components/localtuya/light.py @@ -115,12 +115,14 @@ def brightness(self): @property def hs_color(self): """Return the hs color value.""" + if self._is_white_mode: + return None return self._hs @property def color_temp(self): """Return the color_temp of the light.""" - if self.has_config(CONF_COLOR_TEMP): + if self.has_config(CONF_COLOR_TEMP) and self._is_white_mode: return int( self._max_mired - ( @@ -239,7 +241,7 @@ def status_updated(self): if supported & SUPPORT_COLOR: self._is_white_mode = self.dps_conf(CONF_COLOR_MODE) == "white" if self._is_white_mode: - self._hs = [0, 0] + self._hs = None if self._is_white_mode: if supported & SUPPORT_BRIGHTNESS: