-
-
Notifications
You must be signed in to change notification settings - Fork 568
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 support for smart pet water dispenser mmgg.pet_waterer.s1 #1174
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.
Thanks for the PR, @ofen! I added a couple of comments inline. Btw, while developing, you can also call pre-commit run -a
(or tox -e lint
) to run all the linting tests locally.
@rytilahti, thank you for feedback. Should we use boolean switch for power on/off property too (same as https://github.com/rytilahti/python-miio/blob/master/miio/airfresh.py#L274)? |
Is there any guide how we can fix not-supported device warning in case of MiotDevice class? Warning due to empty |
Changes applied according to previous comments. Toggleable boolean method also added for power on/off flow https://github.com/rytilahti/python-miio/pull/1174/files#diff-bda18cd53fbc82e46003cf9e1272b2bff4f747ca8db0dad73ca6f6f2956c98f9R153-R163 but should be discussed (should we use two separate methods or single with boolean switch for this particular case). |
Turning on and off should be implemented by
This is fixed by defining a class variable like here: https://github.com/rytilahti/python-miio/blob/master/miio/integrations/vacuum/roborock/vacuum.py#L146 |
…mments + some status properties renamed to show return values e.g. days/minutes
@rytilahti done
|
Codecov Report
@@ Coverage Diff @@
## master #1174 +/- ##
==========================================
+ Coverage 78.30% 78.39% +0.09%
==========================================
Files 84 88 +4
Lines 9518 9657 +139
Branches 775 782 +7
==========================================
+ Hits 7453 7571 +118
- Misses 1879 1897 +18
- Partials 186 189 +3
Continue to review full report at Codecov.
|
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.
Looking good, here another round of comments! Please do not forget to add an entry to README.md's supported devices list.
…rns `timedelta` objects + code clean-up + status() return object comment + README update
@rytilahti all above done |
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.
Looking great!
One last wish, could you at least add some tests to the PetWaterDispenserStatus
? Nothing fancy is needed here, simply verifying that that the example payload is parsed correctly:
data = (the example response)
def test_status():
status = PetWaterDispenserStatus(data)
assert status.is_on is True
assert status.sponge_filter_left_days == timedelta(days=10)
# and so on
Also, instead of using __init__.py
as the main code file, it'd be better to store the code elsewhere and just import the exported symbols (e.g., PetWaterDispenser
) in side the __init__.py
. I notice that this is not properly done in other integrations either, so sorry for that confusion.
@rytilahti moved code from |
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.
LGTM, thanks! 🎉
#897
Tested on following hardware
Model: mmgg.pet_waterer.s1
Hardware version: esp8266
Firmware version: 2.1.3_0013