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.
This commit is contained in:
Teemu R 2023-12-08 15:16:45 +01:00 committed by GitHub
parent 16ba87378d
commit 1e2241ee95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}
}
)