fishbigger / TapoP100

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

L530 bulb setBrightness() does not work for single digit brightnesses (1 - 9) #99

Open Edwin-LAC opened 1 year ago

Edwin-LAC commented 1 year ago

Hi, I am having an issue setting the brightness level of my L530 bulb to single digits (1 - 9).

l530.setBrightness(10) # no issues, brightness does change l530.setBrightness(11) # no issues, brightness does change l530.setBrightness(100) # no issues, brightness does change l530.setBrightness(1) # Exception: Error Code: -1003, JSON formatting error l530.setBrightness(9) # Exception: Error Code: -1003, JSON formatting error

I'm running the latest firmware on my L530 bulb (1.2.2 Build 20220110 Rel. 72329).

Edwin-LAC commented 1 year ago

It seems that single digit integers are not allowed. Converting them to a float solves the issue:

l530.setBrightness(float(1)) # works, brightness is set to 1 percent

m-mihaly commented 1 year ago

Thanks @Edwin-LAC, converting to float really solves this issue, but I've found another way.

You can try to revert this commit: https://github.com/fishbigger/TapoP100/commit/698100d123be3387f598dea3b60398c7952c95d9

setBrightness(1) worked for me with a real requestTimeMils value. Payload: {'method': 'set_device_info', 'params': {'brightness': 1}, 'requestTimeMils': 1679177292244}

L510, Firmware: 1.2.2 Build 20220110 Rel. 72329