-
-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Yeelight support (expose more properties, add support for secondary lights) #1035
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a very quick review, I haven't yet tested the code on my own lights but I'll try to do that soonish to make sure this doesn't break anything.
Hi @Kirmas and thanks for the PR! :-)
Yes, I think that is fine. Using several different classes would make it really confusing for users at some point, something we have been seeing recently with some other integrations. At some point in the future, I have some plans to integrate some sort of "supported features" property based on the model to make it simpler to allow the class (and the downstream) to adapt to different types of lights.
I think the best approach wrt homeassistant integration would be to have a This way the homeassistant integration would just require a single update (and single light implementation) even if there are multiple light elements available. Or at least this is how I imagine it would work :-) |
@rytilahti additional question: what type off data better use for flow_params and bg_flow_params: |
A string is easier to manage for now. If it's just passed around and not manipulated. Adding new flows by configuration as strings would be easy. |
@Kirmas I think the yeelight's spec defines the elements of the flow, so I think it would be best to use a separate container class (similar to the status container) to parse and store this data for easier use. But having it as a string for the time being is also fine (and better for comprehension than converting it into a list). python-yeelight does implement some parsing (and building of flows), but I'm not sure if that can be easily used here. We want no external dependencies for this, and there might be a clash in licenses between these two projects which makes direct code sharing harder.. |
- YeelightSubLight was inherited from the DeviceStatus - added cli_format_lights property
@rytilahti what I must to do next, for this PR? Is it ok to be merged or requires additional work? |
@Kirmas a test or two for the secondary light would be great to have to avoid breaking the functionality inadvertently in the future, otherwise this is good to go! 👍 |
@rytilahti I added new devices to the yeelight test but not sure if I did it right. Please review. PS: |
@Kirmas if you want, you/we could create a YAML file containing the data from python-yeelight and use that in this library for the time being. That file (and potential wrappers) can then be extracted into a separate lib later on, if wanted. About the color mode, hmm, ohkay, it is probably then better to use the model info data to raise an exception if the library user tries to use features that are not supported by the light. Wrt the tests, I think there should be a single "CommonBulb" that tests all the common features, leaving only the feature specific tests to their own classes. Could you please do that and then we can merge this and continue further improvements in separate PRs? P.S. I adjusted the title a bit to make it clearer what was improved, feel free to edit it if you wish though! |
@rytilahti Hello, sorry i missed one week. There was no time. I have added a general test. Now everything is fine? For my opinion test status must be totally unique for different types of lamp. |
And other question. I couldn't understand why tests is failed. I didn't change files were they failed. Could you help with this? |
Hi, no worries! Yes, I think it's fine for now as it is. Hmm, that linting error is odd and I cannot reproduce it locally on this branch. Could you try to modify the |
In this pull request I want to add more property to Yeelight (I looked to python-yeelight and operation specification). Base reason of this because Yeelight closing lan controle for theirs lamps that`s why I want to add all functionality from python-yeelight to this repository. This is first PR from many :)
@rytilahti due to this pull request I want to ask some question:
I would be grateful for any criticism