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

Support for Xiaomi Vaccum Mop 2 Ultra and Pro+ (dreame) #1356

Merged
merged 9 commits into from
Mar 19, 2022

Conversation

2pirko
Copy link
Contributor

@2pirko 2pirko commented Mar 13, 2022

Support for 2 new dreame devices:

  • Xiaomi Vaccum Mop 2 Ultra (dreame.vacuum.p2150a)
  • Pro+ (dreame.vacuum.p2041o)

Fixes #1274

@codecov-commenter
Copy link

codecov-commenter commented Mar 13, 2022

Codecov Report

Merging #1356 (7723bfa) into master (af1e31a) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1356      +/-   ##
==========================================
+ Coverage   82.17%   82.21%   +0.04%     
==========================================
  Files         109      109              
  Lines       11784    11796      +12     
  Branches     1386     1386              
==========================================
+ Hits         9683     9698      +15     
+ Misses       1893     1892       -1     
+ Partials      208      206       -2     
Impacted Files Coverage Δ
...io/integrations/vacuum/dreame/dreamevacuum_miot.py 76.19% <100.00%> (+1.27%) ⬆️
...ions/vacuum/dreame/tests/test_dreamevacuum_miot.py 100.00% <100.00%> (ø)
miio/airpurifier_miot.py 83.08% <0.00%> (ø)

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@rytilahti rytilahti changed the title Added Xiaomi Vaccum Mop 2 Ultra and Pro+ Added Xiaomi Vaccum Mop 2 Ultra (dreame.vacuum.p2150a) and Pro+ (dreame.vacuum.p2041o) Mar 13, 2022
@rytilahti rytilahti changed the title Added Xiaomi Vaccum Mop 2 Ultra (dreame.vacuum.p2150a) and Pro+ (dreame.vacuum.p2041o) Support for Xiaomi Vaccum Mop 2 Ultra and Pro+ (dreame) Mar 13, 2022
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 @2pirko! This can be merged after the checks pass (run pre-commit run -a locally to fix it).

@2pirko
Copy link
Contributor Author

2pirko commented Mar 13, 2022

@rytilahti , when these changes will be available in HA? Do you update every month? Or does HA team update automatically each month?
Thanks for the integration. I'm looking forward to have this working!

@rytilahti
Copy link
Owner

Would you mind updating the README to include the new models? On homeassistant support, there is no real release schedules really. The problem with homeassistant integration is that it currently only supports roborock vacuums, so that's a bigger blocker than a new release, I'm afraid.

@2pirko
Copy link
Contributor Author

2pirko commented Mar 14, 2022

Would you mind updating the README to include the new models? On homeassistant support, there is no real release schedules really. The problem with homeassistant integration is that it currently only supports roborock vacuums, so that's a bigger blocker than a new release, I'm afraid.

Hi @rytilahti , README updated. Could you provide additional hints, what needs to be done to add support to HA? Can I help with this? Thx

@rytilahti
Copy link
Owner

Hi @2pirko, in order to add support to homeassistant, there are at least the following steps are necessary:

  • Add interface to instantiate the implementation classes based on the given model (work in progress in Add common API for constructing device instances, improve introspection #1328)
  • Add common "vacuum" interface and consolidate the existing integrations to use it. This is much bigger task than I anticipated, as it involves building abstractions for things like how to enforce that different integrations implement the interface, how to signal about available features, etc.
  • And last of all, make homeassistant to use these facilities instead of hardcoding the vacuum support to use the roborockvacuum.

If you have an idea what's the best approach to implement that common interface, that would help a lot! I have some plans, but it is unclear what is the best way to approach this, e.g., how to enforce that all vacuum implementations implement the interface, and how to map statuses to homeassistant statuses, etc.

I'm thinking about using typing.Protocols to define some base set of methods and properties that needs to be implement, just to add some basic support to homeassistant for all vacuums supported by this library, but how to handle things like consumables & cleaning history is fuzzy.

Besides having an idea of how to approach those challenges, I think the best help would be to make sure that the dreame implementation follows the same API as RoborockVacuum, as well as figuring out which states should be mapped to which homeassistant states (see https://github.com/home-assistant/core/blob/171c58fed2483b471d3b76cc223dd68812ebcde0/homeassistant/components/xiaomi_miio/vacuum.py#L78-L99) so that this library can have a common interface towards homeassistant for that.

@rytilahti rytilahti merged commit c900b9e into rytilahti:master Mar 19, 2022
Repository owner deleted a comment from antoweb Apr 11, 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.

Request for new vacuum xiaomi mop 2 pro+ (dreame.vacuum.p2041o)
3 participants