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 fan_speed_presets() for querying available fan speeds #643

Merged
merged 3 commits into from
Mar 27, 2020

Conversation

rytilahti
Copy link
Owner

This returns a dictionary {name, value} of the available fan speeds,
the main driver being the need to simplify homeassistant integrations for different devices.

For viomi vacuums this is currently straightforward and hard-coded, but we do special handling
for rockrobo devices (based on info() responses):

  • If the query succeeds, newer firmware versions (3.5.7+) of v1 are handled as a special case,
    otherwise the new-style [100-105] mapping is returned.

  • If the query fails, we fall back to rockrobo v1's percentage-based mapping.
    This happens, e.g., when the vacuum has no cloud connectivity.

Related to #523

Related downstream issues
home-assistant/core#32821
home-assistant/core#31268
home-assistant/core#27268

This returns a dictionary {name, value} of the available fan speeds,
the main driver being the need to simplify homeassistant integrations for different devices.

For viomi vacuums this is currently straightforward and hard-coded, but we do special handling
for rockrobo devices (based on info() responses):

* If the query succeeds, newer firmware versions (3.5.7+) of v1 are handled as a special case,
  otherwise the new-style [100-105] mapping is returned.

* If the query fails, we fall back to rockrobo v1's percentage-based mapping.
  This happens, e.g., when the vacuum has no cloud connectivity.

Related to #523

Related downstream issues
home-assistant/core#32821
home-assistant/core#31268
home-assistant/core#27268
@coveralls
Copy link

coveralls commented Mar 15, 2020

Coverage Status

Coverage decreased (-1.5%) to 72.765% when pulling b7b9113 on fanspeed_reporting into 5f8aa72 on master.

rytilahti added a commit to rytilahti/home-assistant that referenced this pull request Mar 15, 2020
This needs input from Xiaomi vacuum owners to verify that it does not break anything.
I have personally tested this on rockrobo v1 (old mapping).

Related issues/PRs:
home-assistant#32821
home-assistant#31268
home-assistant#27268

This is a WIP as it requires a new upstream release.
The PR is rytilahti/python-miio#643
@rytilahti
Copy link
Owner Author

This has been tested now with the gen1 (old firmware) as well as Roborock S4 and S55 v2. Unfortunately no updates from anyone running gen1 with a newer firmware, but let's get this merged and released to finally fix the issue for non-gen1 users at least.

@rytilahti rytilahti merged commit 86de386 into master Mar 27, 2020
@rytilahti rytilahti deleted the fanspeed_reporting branch March 29, 2020 14:10
balloob pushed a commit to home-assistant/core that referenced this pull request Apr 2, 2020
* Use backend-provided fan speed presets for Xiaomi vacuums

This needs input from Xiaomi vacuum owners to verify that it does not break anything.
I have personally tested this on rockrobo v1 (old mapping).

Related issues/PRs:
#32821
#31268
#27268

This is a WIP as it requires a new upstream release.
The PR is rytilahti/python-miio#643

* Bump version requirement for 0.5.0

* Bump requirements_test_all.txt, too

* Fix linting; missing setup.cfg on local checkout caused wrong settings for black..

* Add tests for both fan speed types

* Remove useless else..

* bump python-miio to 0.5.0.1 due to broken 0.5.0 packaging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants