Closed DiegoRBaquero closed 5 years ago
You're welcome. Yes, the scope of this project is HS range of smart switches, rather than LB bulbs. I don't have any smart bulbs, so am not sure how to go about controlling them.
That said, the API response you've given makes complete sense. I'll have a look around and see if I can find a friendly LB130 to snoop upon, and see methods it might respond to. If it looks doable, I'll create a branch that we can experiment with, but may need to lean on you for testing.
OK?
@DiegoRBaquero
I've created an experimental branch to see if I can work out how to control the bulb. If this works, I will look to see if I can detect its a bulb from the response we get back on the device. As above, I'll need your input to diagnose issues as I don't have any bulbs to try this with.
https://github.com/arallsopp/tp-link-smart-switch-web-client-/tree/experimental-bulb-support
I'm assuming you're good to pull the branch and take a look? Let me know if you need it hosted on a codepen.
I learned that LB100/110, LB120 and LB130 are different.
For LB130 (which is colored) this must be the payload:
{
"smartlife.iot.smartbulb.lightingservice": {
"transition_light_state": {
"on_off": 0/1,
"brightness": 0-100,
"hue": 0-360,
"saturation": 0-100,
"color_temp": 0 (for color)/2500-9000 for yellow-white-blue,
"transition_period": 0 in ms,
"ignore_default": 0/1
}
}
}
This can surely help:
https://github.com/plasticrake/tplink-smarthome-api/blob/master/src/bulb/lighting.js#L103 https://github.com/adumont/tplink-cloud-api/blob/master/lb130.js#L34 https://github.com/konsumer/tplink-lightbulb/blob/master/src/lib.js#L132
First, let me say this is amazing! Thank you for building this.
Second, I'm having an issue with setting my bulb (LB130) on/off, the API response is:
I'm guessing it's trying to control it as a smart plug while being a bulb?