From 8f6078a7ed46f8f4257bd439c715f92c9c07fda5 Mon Sep 17 00:00:00 2001 From: Alex X Date: Wed, 4 Sep 2024 23:11:38 +0300 Subject: [PATCH] Revert buggy changes for lights state in v4.0.5 --- custom_components/xiaomi_gateway3/light.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/custom_components/xiaomi_gateway3/light.py b/custom_components/xiaomi_gateway3/light.py index 9b6d25e9..fcb74154 100644 --- a/custom_components/xiaomi_gateway3/light.py +++ b/custom_components/xiaomi_gateway3/light.py @@ -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