Added effects to Yeelight bulbs#7152
Conversation
|
@Mister-Espria, thanks for your PR! By analyzing the history of the files in this pull request, we identified @rytilahti, @jjensn and @HydrelioxGitHub to be potential reviewers. |
|
Hi @Mister-Espria, It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
|
Hi @Mister-Espria, It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
There was a problem hiding this comment.
I think you mean duration=2000 here, not 200
There was a problem hiding this comment.
Yes typo i will fix it!
There was a problem hiding this comment.
You want randrange(0, 256) or randint(0, 255)
There was a problem hiding this comment.
random.randrange(0, 255) is used in the flux component. i did't give it any thought. So i should change it into random.randint(0, 255) right?
There was a problem hiding this comment.
Yes, if you want 255 as a possible outcome. Not that anyone will be able to tell the difference 😃
There was a problem hiding this comment.
Nope but then it is as random as it can get 😄 . So i will change it.
There was a problem hiding this comment.
I think that the logic for the effects should be located in the yeelight module itself. This way the effects can be maintained at one place.
There was a problem hiding this comment.
Thanks for your response. I think you are right, that the best place for it is in the yeelight module. I have tried to make a start with adding it there. But with trial and error i'm getting nowhere. I have no clue on how to start the implementation there. I will still be trying, but i'm not certain i will get it done 😃
What do you want me to do with this PR?
There was a problem hiding this comment.
This is being discussed here: https://gitlab.com/stavros/python-yeelight/issues/11 so I'd propose closing this PR for now and reopening/creating a new one after the implementation hits the upstream :-)
There was a problem hiding this comment.
Ok. I will do that now. Thank you.
|
I'm re-opening this PR, because there are now effects implemented in the |
| EFFECT_TWITTER = "Twitter" | ||
| EFFECT_STOP = "Stop" | ||
|
|
||
| YEE_EFFECT_LIST = [ |
There was a problem hiding this comment.
YEELIGHT_EFFECT_LIST to be consistent?
There was a problem hiding this comment.
Thanks for your quick review. This is something i thought of and then forgot it of course.
Thank you i will change it.
| strobe_color, alarm, police, | ||
| police2, christmas, rgb, | ||
| randomloop, slowdown) | ||
| # transition = int(self.config[CONF_TRANSITION]) |
| randomloop, slowdown) | ||
| # transition = int(self.config[CONF_TRANSITION]) | ||
| if effect == EFFECT_DISCO: | ||
| flow = Flow(count=0, transitions=disco(),) |
There was a problem hiding this comment.
Any reason these are passed as tuples? A list is expected? Maybe it'd make sense to do [disco()] to make it clear transitions expects an iterable? (Or in even better case, it should also allow single transitions...)
There was a problem hiding this comment.
Probably my incompetence. The reason i have this is because this is how i did it to get it to work. the disco function returns a list with the transitions. I just tried you example [disco()] but i can't get it to work. maybe i need to do something other then replace disco() with [disco()] ?
There was a problem hiding this comment.
Hmm, and passing the list directly does not work? To my understanding it should..
There was a problem hiding this comment.
Yes just passing the list with transitions does work, but that is what i originally had.
@fabaff commented:
I think that the logic for the effects should be located in the yeelight module itself. This way the effects can be maintained at one place.
So this way we don't have to maintain the list for every transition, in case of changes in the yeelight module
There was a problem hiding this comment.
Ah, I mean passing "disco()" as a parameter to transitions like:
Flow(count=0, transitions=disco())
should work. @fabaff is correct by saying that the implementation details belong to the module itself, where they are now thanks to you! :-)
There was a problem hiding this comment.
Ah i see, That works! thank you i have changed it. And i completely agree with having the effects over there.
| if effect == EFFECT_TWITTER: | ||
| flow = Flow(count=2, transitions=pulse(0, 172, 237),) | ||
|
|
||
| if effect == EFFECT_STOP: |
There was a problem hiding this comment.
Should this be before other checks?
There was a problem hiding this comment.
Yes i think that will make more sense. Changing it now.
balloob
left a comment
There was a problem hiding this comment.
Looks good. Sorry for this taking so long. 🐬
|
Neat effects! Thanks for your work @Mister-Espria 👍 |
Description:
This PR is now reopened, because there are now effects implemented in the
yeelightmodule version 3.0.0.I did update the original code of this PR to support the newly implemented effects.
Any suggetions/improvements are welcome of course.
PR text before closing:
Related issue (if applicable): fixes #
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>
Example entry for
configuration.yaml(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
toxrun successfully. Your PR cannot be merged unless tests passREQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices:
toxrun successfully. Your PR cannot be merged unless tests pass