-
Notifications
You must be signed in to change notification settings - Fork 128
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
HS220 dimmer switch feature - set_dimmer_transition duration #143
Comments
Is this behaviour different (Adjusting global transition? Only for brightness?) from #98? |
This is for the smartplug class (dimmer switch), not smartbulb. Also, this is a independent function and the duration only applies to the change in brightness. It's not yet implemented anywhere in this codebase. It allows you to change the brightness setting from 0% to 100% and set a time period for this change, instant or gradual. I found it very useful and I can make a pull request soon. |
I think the best way to add this would be similar to described in that PR. So instead of overloading |
I'm not sure exactly how you want this implemented, here is my attempt |
So here's how I imagine it should work, the existing code in the brightness setter should be moved into
and the existing
This way the only API change is adding a new method, which will allow specifying the transition. The existing brightness setter keeps functioning as it used to for those who want to use it. I think this keeps the code cleaner and avoids breaking the API (for the time being). |
The duration of the brightness transition can be modified using the following code:
self._query_helper("smartlife.iot.dimmer", "set_dimmer_transition",{"brightness": value, "duration":1})
A value of 1 is the minimum. Setting duration to 1000 results in a 1 second transition. Should I create a pull request implementing a new flag called dimmer_transition that accepts both a brightness and a duration?
This could also be implemented as a separate flag, if this duration flag is present then the
set_dimmer_transition
key can be used instead ofset_brightness
and the two values would be passed to the dimmer switch.The text was updated successfully, but these errors were encountered: