-
-
Notifications
You must be signed in to change notification settings - Fork 239
Add transition support for SmartDimmer #69
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
Add transition support for SmartDimmer #69
Conversation
6205b84 to
319b510
Compare
Codecov Report
@@ Coverage Diff @@
## master #69 +/- ##
==========================================
- Coverage 62.00% 61.33% -0.68%
==========================================
Files 9 9
Lines 1145 1169 +24
Branches 169 177 +8
==========================================
+ Hits 710 717 +7
- Misses 398 411 +13
- Partials 37 41 +4
Continue to review full report at Codecov.
|
|
Thanks for your contribution! Can you please add some test cases so we don't break this functionality by mistake in the future? |
rytilahti
left a comment
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.
Looks great, thanks for the PR! Just a couple of minor changes (besides adding some tests) are needed.
|
@connorproctor to give you an idea about how to test that the methods are being called properly using the transition (and without), check out the linked PR. edit: btw, does the transitions also work for |
I'm not aware of a way of passing a transition duration to the switch when using |
|
I'm trying to write tests but when running them on my computer all the I'm getting this error: However I do have Any ideas for how to get the tests running? |
|
That's really odd and I'm afraid I don't have any direct answer for that. Using poetry should create a working dev environment (including the necessary libs for testing, such as pytest-asyncio), but as you have it installed, I'm not really sure what is going on... When you execute |
|
With a fresh poetry environment these were my pytest plugins when running I manually installed all the plugins you have listed and now most of the tests run. Thanks for the help. This is my first time using poetry, so I'm not sure where the problem is, but I imagine there's a missing dependency or two. |
319b510 to
a5c180f
Compare
|
Doing Anyway, in case you had already activated virtualenv, the install will also use that (that's how I have my own dev setup). |
224b311 to
152c7a7
Compare
|
I'm not sure if it's something weird with my local setup or not, but it looks like the missing dependency that fixed the tests was I updated the tests, let me know what you think. |
Indeed, I did also check that out and looks like it is not working, and the same thing also happens on CI for other python versions than what I have locally (3.8), but as it's a warning I never noticed that... This is really odd, I'm curious what causes it to work when installing pytest-aiohttp (which I confirmed is the case)? As we are not using aiohttp in this library, adding its pytest plugin as a dependency feels wrong. A short googling reveals this pytest-dev/pytest#7144 but we are not really using unittest here, either.. |
* Adds a transition param to set_brightness(), turn_on(), and turn_off() that specifies the duration in milliseconds that the dimmer switch will take to transition to the new state. * Fixes bug where set_brightness(0) was allowed even though the dimmer does not support it. Now brightness values of 0 are coerced to 1 to be consistent with bulbs (which do support brightness values of 0).
152c7a7 to
6eaa318
Compare
rytilahti
left a comment
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.
Looks go to go, thanks! 👍 I'm only confused why this does not trigger a mypy error like my PR did..
This is a stab at the first part of #44.
Closes #44