fishbigger / TapoP100

A module for controlling the TP-Link Tapo P100 Plugs
MIT License
566 stars 138 forks source link

KeyError: '-1008' is raised when setting only either the hue or saturation in the setColor() function for L530 bulbs #110

Open MonicaisHer opened 1 year ago

MonicaisHer commented 1 year ago

When setting only one of the hue or saturation for the Tapo L530 bulb, the setColor() function throws a KeyError: '-1008' error. It would be useful if the function could accept setting only the hue or saturation, as there may be a scenario where the hue is already set and the user only wants to modify the saturation.

Perhaps some code similar to the following could be added to the setColor() function:

Payload = {
    "method": "set_device_info",
    "params":{}
}
if hue is not None:
    Payload["params"]["hue"] = hue
if saturation is not None:
    Payload["params"]["saturation"] = saturation