From a96b6d61fc911cef8b139451384fd9f62776b2c0 Mon Sep 17 00:00:00 2001 From: Alex X Date: Tue, 12 Nov 2024 17:59:44 +0300 Subject: [PATCH] Fix turn on mesh light on brightness or color_temp commands #1459 --- custom_components/xiaomi_gateway3/light.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/xiaomi_gateway3/light.py b/custom_components/xiaomi_gateway3/light.py index fcb74154..8698ce1d 100644 --- a/custom_components/xiaomi_gateway3/light.py +++ b/custom_components/xiaomi_gateway3/light.py @@ -79,7 +79,10 @@ def get_state(self) -> dict: } async def async_turn_on(self, **kwargs): - self.device.write(kwargs if kwargs else {self.attr: True}) + # https://github.com/AlexxIT/XiaomiGateway3/issues/1459 + if not self._attr_is_on or not kwargs: + kwargs[self.attr] = True + self.device.write(kwargs) async def async_turn_off(self, **kwargs): self.device.write({self.attr: False})