Skip to content
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 the Xiaomi/Viomi Dishwasher (viomi.dishwasher.m02) #877

Merged
merged 4 commits into from
Sep 24, 2022

Conversation

TheDJVG
Copy link
Contributor

@TheDJVG TheDJVG commented Dec 1, 2020

Supported commands

  • Power on/off.
  • Start/stop/pause/continue a program.
  • Schedule a program for a specific time (and cancel it).
  • Retrieve current status + errors of the dishwasher.
  • Child lock enable/disable.
  • Set air refresh interval.

fix #874

@TheDJVG
Copy link
Contributor Author

TheDJVG commented Dec 1, 2020

I'm not sure how I can fix these two Windows test failures as I don't think it has anything to do with my changes. Feedback appreciated.

@syssi
Copy link
Collaborator

syssi commented Dec 1, 2020

The windows tests are failing sometimes and can be ignored here.

Copy link
Owner

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on the PR! 🥇 I restarted the windows build and it went fine, it's flaky sometimes as syssi mentioned.

I did a brief initial review, to summarize:

  • Prefer booleans instead of enums for boolean values.
  • Add docstrings to public functions, examples for data payloads.
  • Log unknown responses so users can report/debug it.
  • Please also update the README.md.
  • Update discovery mapping if the device is discoverable via mdns.

On the flattening of the requests, I haven't given a thought on that for now, but if the same issue affects other devices (maybe a buggy sdk version?) we should deal with it in Device class. Otherwise, overriding send could work as a stopgap solution.

@syssi do you have any devices that only support max_properties=1 to try out if flattening would allow querying multiple properties on those?

miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
@syssi
Copy link
Collaborator

syssi commented Dec 1, 2020

@syssi do you have any devices that only support max_properties=1 to try out if flattening would allow querying multiple properties on those?

I would like to test the flatten_request feature on my deerma.humidifier.jsq. Could you provide a PR? I couldn't find the implementation.

@rytilahti
Copy link
Owner

rytilahti commented Dec 1, 2020

Ohh, it wasn't a PR but an issue: #875 . Testing with a raw-command would work for initial testing :-) Looks like testing with raw command won't work, but the issue contains a code snippets.

@TheDJVG
Copy link
Contributor Author

TheDJVG commented Dec 5, 2020

Sorry all! Was a bit of a busy week here. Will try to push the changes to address the feedback this weekend.

@TheDJVG TheDJVG requested a review from rytilahti December 8, 2020 10:11
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
miio/viomidishwasher.py Outdated Show resolved Hide resolved
TheDJVG and others added 3 commits September 25, 2022 00:40
Supported commands
- Power on/off.
- Start/stop/pause/continue a program.
- Schedule a program for a specific time (and cancel it).
- Retrieve current status + errors of the dishwasher.
- Child lock enable/disable.
- Set air refresh interval.

fix rytilahti#874
- Updated README
- Added docstrings to all publics properties and methods.
- Logging of unknown values.
- Removed DoorStatus and PowerStatus in favor of bools.
- Log events and return the actual value from .send().
- Updated tests (removed unused Program check as this is an internal action by the Dishwasher)
- time_left is now returned as timedelta in seconds.
- Various typing optmizations.
- Multiple status properties now use bools instead of Enums.

Signed-off-by: Daan van Gorkum <djvg@djvg.net>
@rytilahti rytilahti force-pushed the new_device/viomi.dishwasher.m02 branch from dab1f83 to d6c44ee Compare September 24, 2022 21:51
@codecov-commenter
Copy link

codecov-commenter commented Sep 24, 2022

Codecov Report

Merging #877 (d2ffa83) into master (966f96a) will decrease coverage by 0.10%.
The diff coverage is 78.59%.

@@            Coverage Diff             @@
##           master     #877      +/-   ##
==========================================
- Coverage   82.05%   81.95%   -0.11%     
==========================================
  Files         149      149              
  Lines       14458    14594     +136     
  Branches     3511     3550      +39     
==========================================
+ Hits        11864    11960      +96     
- Misses       2361     2387      +26     
- Partials      233      247      +14     
Impacted Files Coverage Δ
...io/integrations/viomidishwasher/viomidishwasher.py 71.10% <71.10%> (ø)
...tegrations/viomidishwasher/test_viomidishwasher.py 98.73% <98.73%> (ø)
miio/integrations/viomidishwasher/__init__.py 100.00% <100.00%> (ø)
miio/__init__.py
miio/device.py
miio/vacuum.py

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Owner

@rytilahti rytilahti left a 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 @TheDJVG and sorry for the delay, hope this can still be useful for someone even when you don't have the device anymore 👍

@rytilahti rytilahti merged commit a1ff575 into rytilahti:master Sep 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Xiaomi Dishwasher (viomi.dishwasher.m02)
5 participants