-
Notifications
You must be signed in to change notification settings - Fork 28
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
Improvement of percent calculation #72
Conversation
Improvement of percent calculation in to_percent() for devices that do not return exactly 51200 as final position when closed.
Thank you :) May I also ask you to add some unit tests (to catch esp edge cases around the maximum and mimimum values.) You could test e.g. raw values for: Another question, don't we have to update the from_percent function as well? |
Your welcome :-) I assume from_percent is used to convert an input command received (e.g. from Home Assistant) to raw (byte array) to send it to KLF200. Since this command will always be accurate (0%-100% i.e. 0-51200) there is no need to add tolerance. The tolerance is only here to compensate the response of Velux Motor that drift slightly from the set_position command. Can you please advise me how to do and publish the unit tests? Thank you! |
An example for a unit test you can see here: https://github.com/Julius2342/pyvlx/blob/master/test/alias_array_test.py It tests the function on a low level (and ensures that the functionality stays the same even after refactorings which happen in the future) |
Hey @Nicks57 , i added the github integration for an automatic execution of unit tests. May I ask you to rebase or merge master? |
Hi Julius! |
Please run The rest looks fine ... |
Done! Thank you for your help. |
Codecov Report
@@ Coverage Diff @@
## master #72 +/- ##
=======================================
Coverage 81.79% 81.79%
=======================================
Files 73 73
Lines 2967 2967
=======================================
Hits 2427 2427
Misses 540 540
Continue to review full report at Codecov.
|
Thank you @Nicks57 :) |
Improvement of percent calculation in to_percent() for devices that do not return exactly 51200 as final position when closed.
Fixes #47