Closed danodemano closed 7 years ago
What kind of bulb are you using? Are you sure it's a LB130? I am using a LB120, which doesn't have support for color (like the LB130), just "temperature". When this library sends a "color" (hex or hsb) it really is sending Hue, Saturation, and Brightness. My bulb doesn't support Hue and Saturation, so it only understands Brightness. I am guessing you have the same bulb because your responses look like mine, where it tracks Hue and Saturation, but they don't actually do anything. Bulbs that do support color will use the combination of those 3 values to make a color, but they also don't support "temperature" like my bulb.
Are you sure it's a LB130?
Yup, changes colors fine from the app and by using the --hue and --saturation commands. Also works via raw (this turns it red):
tplight raw 192.168.9.199 '{"smartlife.iot.smartbulb.lightingservice":{"transition_light_state":{"ignore_default":1,"on_off":1,"color_temp":0,"hue":0,"saturation":100}}}'
Interesting. It may be something funny with temperature, as the other people with LB130 got it working ok. Maybe I should zero that out for "color" commands. It's honestly all very hit-and-miss since I don't have the LB130, I just kinda have to guess 😄
@DaveGut mentioned that my suspicions were correct on the other issue. 😄 I will add that.
Sweet, thanks!
Ok, published as v1.1.6
. Give it a try and let me know!
Update with npm i -g tplink-lightbulb
Here is the most useful stuff to test:
# these should work on everyone's
tplight scan -t 1 # does it find your bulbs?
tplight on <IP> # does it turn on the light?
# these work on LB120, but not yours
tplight temp <IP> 10000 # is it blue?
tplight temp <IP> 1 # is it orange?
# after those try these (only work on yours)
tplight hex <IP> '#ff0000' # is it red?
tplight hex <IP> '#00ff00' # is it green?
tplight hex <IP> '#0000ff' # is it blue?
tplight hsb <IP> 72 58 35 # is it purple?
<IP>
should be an IP from tplight scan
Sending unsupported commands (color for LB120, temp for LB130) should just silently fail but not hurt anything, as that's what the bulb does (and there is no way to detect a fail, other than model-numbers), but I'd prefer if the lib still worked for unsupported commands and didn't screw up supported ones. I think it supports that now, but as I said, I need testing to be sure.
All of them work (even the middle ones that you said wouldn't) except for the HSB command.
root@ha:~# tplight hsb 192.168.9.199 72 58 35
{
"on_off": 1,
"mode": "normal",
"hue": 72,
"saturation": 58,
"color_temp": 0,
"brightness": 35,
"err_code": 0
}
It's like a dull yellow-green
Yeh, I got the color wrong somehow. that is actually what I would expect! I double-checked with a color-converter:
Thanks for your testing, and @DaveGut for awesome bulb-hacking. Should I close this one?
Sweet. And yep, go ahead and close it. Really appreciate you working so hard on this!
Also, good to know your bulb supports temp.
Color change doesn't work, only changes the brightness: