python-miio icon indicating copy to clipboard operation
python-miio copied to clipboard

Yeelight spec files was added

Open Kirmas opened this issue 3 years ago • 3 comments

I add almost all function from the yeelight documentation except of set_scene, set_music, set_adjust, adjust_bright, adjust_ct, adjust_color :

  • for "adjust" functions it is not difficult to add but I really don`t understand why we need this.(maybe if there is some free time before someone looks, I will add)
  • for set_scene - I dont understand how it must work. What is the best parameters set, maybe I must to add one more .yaml file with scenes?
  • for set_music - How it must work? What server we can/must use for this?

I haven`t provide new tests for this because I want to have prufe of concept first. @rytilahti could you take a look at this and give your opinion

Kirmas avatar Jul 11 '21 21:07 Kirmas

To your question in the description:

  • for "adjust" functions it is not difficult to add but I really don`t understand why we need this.(maybe if there is some free time before someone looks, I will add)

So the idea of these functions is to allow adjusting the state of the bulb relative to its current state, making it possible to execute commands like "increase brightness by 10%" or "increase color temperature by 500k".

  • for set_scene - I dont understand how it must work. What is the best parameters set, maybe I must to add one more .yaml file with scenes?

I'm not sure about how the API should look like for this, but the idea of these scenes is to allow setting multiple variables at once. For example, set_hsv allows just controlling the 'h' and 's' of the hsv, but using set_scene allows adjusting the v, too. Same applies to the color temperature, allowing to change from 7000k with 10% to 2500k with 50% using a single call.

  • for set_music - How it must work? What server we can/must use for this?

python-yeelight implements this mode. Basically, the idea is that instead of polling the device for updates, you open a listening socket and let the bulb connect to you. This allows receiving immediate updates when the light state changes (e.g., when being controlled by the official app).

Personally, I don't think that this library should implement this feature (at least not at the moment) as it will make the code more complicated.

rytilahti avatar Jul 13 '21 01:07 rytilahti

Therefore I suggest that instead of introducing a new data directory, please create a new directory to hold all the auxiliary files.yeelight_specs``yeelight

I have tried to rename yeelight_specs folder to yeelight and after this could not resolve import (Two module with the same name), as I understand this is task for next PR or I`ll must use some work around in the this PR?

Kirmas avatar Jul 13 '21 07:07 Kirmas

I have tried to rename yeelight_specs folder to yeelight and after this could not resolve import (Two module with the same name), as I understand this is task for next PR or I`ll must use some work around in the this PR?

Ah, indeed.. Okay, let's keep the directory as it is currently and do the rename in another PR after this gets done.

rytilahti avatar Jul 13 '21 12:07 rytilahti