mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-04-27 17:16:24 +00:00
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:
parent
16ba87378d
commit
1e2241ee95
@ -157,12 +157,19 @@ class TapoBulb(TapoDevice, SmartBulb):
|
|||||||
if value is not None:
|
if value is not None:
|
||||||
self._raise_for_invalid_brightness(value)
|
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(
|
return await self.protocol.query(
|
||||||
{
|
{
|
||||||
"set_device_info": {
|
"set_device_info": {
|
||||||
"hue": hue,
|
**request_payload
|
||||||
"saturation": saturation,
|
|
||||||
"brightness": value,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user