Skip to content

Commit

Permalink
Revert buggy changes for lights state in v4.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Sep 4, 2024
1 parent ee24e95 commit 8f6078a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions custom_components/xiaomi_gateway3/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,13 @@ def on_init(self):
self._attr_supported_color_modes = modes if modes else {self._attr_color_mode}

def set_state(self, data: dict):
# we turn_on light on any brightness or color_temp data without light state
# fix https://github.com/AlexxIT/XiaomiGateway3/issues/1335
if self.attr in data:
self._attr_is_on = bool(data[self.attr])
if ATTR_BRIGHTNESS in data:
self._attr_brightness = data[ATTR_BRIGHTNESS]
data.setdefault(self.attr, True)
if ATTR_COLOR_TEMP in data:
self._attr_color_temp = data[ATTR_COLOR_TEMP]
self._attr_color_mode = ColorMode.COLOR_TEMP
data.setdefault(self.attr, True)
if self.attr in data:
self._attr_is_on = bool(data[self.attr])
if ATTR_HS_COLOR in data:
self._attr_hs_color = data[ATTR_HS_COLOR]
self._attr_color_mode = ColorMode.HS
Expand Down

0 comments on commit 8f6078a

Please sign in to comment.