Skip to content

Commit

Permalink
Use default home assistant behavior. Return only relevant data per mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
ultratoto14 committed Nov 4, 2020
1 parent 657850e commit 801bf13
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions custom_components/localtuya/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,14 @@ def brightness(self):
@property
def hs_color(self):
"""Return the hs color value."""
return self._hs
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
- (
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 801bf13

Please sign in to comment.