thomas-bouvier / yeelight-node

💡 A simple Node.js library to discover and control Xiaomi Yeelights over LAN
MIT License
30 stars 7 forks source link

start_cf not working for new bulbs #10

Open Connum opened 2 years ago

Connum commented 2 years ago

I've had a YLDP005 for some months now that works great with this package.

Today I received two YLDP06YL. set_rgb and set_ct_abx work fine, but when I send the same start_cf command to all three, the YLDP005 does what it always did, but the two new bulbs will return an error:

yeelight.start_cf(0,1,[[333,1,0,1],[333,1,255,100]])
> {"id":*, "error":{"code":-5000,"message":"general error"}}

First I thought that maybe that model doesn't support color flows, but they do work from the Yeelight app.

Any idea? All three bulbs are on their latest firmware: YLDP005 (Model: yeelink.light.colorb): firmware 2.0.8_0010 YLDP06YL (Model: yeelink.light.color1): firmware 1.4.2_0076

Connum commented 2 years ago

It seems that some models don't support a color value of 0, while others do, so the following worked:

yeelight.start_cf(0,1,[[333,1,1,1],[333,1,255,100]])

Interestingly, these models seem to have an undocumented color mode 3 that will turn the light off:

yeelight.start_cf(0,1,[[333,3,0,0],[333,1,255,100]]) But that doesn't work with the other models then... 😖

thomas-bouvier commented 2 years ago

Hey @Connum, many thanks for the feedback!

Unfortunately I don't have any YLDP06YL to test all of this by myself. Actually, I'm not even using this library anymore.

I couldn't find any docs for this specific model. Is a patch needed in the end? When passing mode 3, is it working as is with your bulb model? If yes, writing a section in the README to document that behavior would be enough?

Connum commented 2 years ago

Thanks for getting back to me! I think we could detect the model and when setting a color flow, check every step if it contains setting the color to 0, and if it does, set the step's mode to 3 and the two other values to 0. I'll see if I can find the time to cook this up myself!

thomas-bouvier commented 2 years ago

Seems fair to me :)