From 1e2241ee95fe07d60a7566e1624b55bd68401762 Mon Sep 17 00:00:00 2001 From: Teemu R Date: Fri, 8 Dec 2023 15:16:45 +0100 Subject: [PATCH] Fix hsv setting for tapobulb (#573) This fixes changing the color for L530: * If color temp is set on the device, it overrides any hue/sat settings. We override it to zero which seems to work. * L530 does not allow None/null for brightness, so we avoid passing it on to the device. --- kasa/tapo/tapobulb.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kasa/tapo/tapobulb.py b/kasa/tapo/tapobulb.py index e01c69b0..7fc9ece9 100644 --- a/kasa/tapo/tapobulb.py +++ b/kasa/tapo/tapobulb.py @@ -157,12 +157,19 @@ class TapoBulb(TapoDevice, SmartBulb): if value is not None: self._raise_for_invalid_brightness(value) + request_payload = { + "color_temp": 0, # If set, color_temp takes precedence over hue&sat + "hue": hue, + "saturation": saturation, + } + # The device errors on invalid brightness values. + if value is not None: + request_payload["brightness"] = value + return await self.protocol.query( { "set_device_info": { - "hue": hue, - "saturation": saturation, - "brightness": value, + **request_payload } } )