-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
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 new fan speed mapping for V2 Roborock Vacuum #20286
Conversation
if value == speed][0] | ||
return speed | ||
|
||
@property | ||
def fan_speed_list(self): | ||
"""Get the list of available fan speed steps of the vacuum cleaner.""" | ||
return list(sorted(FAN_SPEEDS.keys(), key=lambda s: FAN_SPEEDS[s])) | ||
return list(sorted(self._speed_map.keys(), key=lambda s: self._speed_map[s])) |
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.
line too long (85 > 79 characters)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ | ||
vol.Required(CONF_HOST): cv.string, | ||
vol.Required(CONF_TOKEN): vol.All(str, vol.Length(min=32, max=32)), | ||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, | ||
vol.Optional(CONF_NEW_FAN_SPEEDS, default=DEFAULT_NEW_FAN_SPEEDS): cv.boolean, |
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.
line too long (82 > 79 characters)
📚Please, update the documentation and open a PR for it (be sure to create a documentation PR against the 🏷 I am adding the 👍 Thanks (times a million!) |
Comment on the previous PR attempt:
|
Relevant comment from the linked issue
So if we want to request to push functionality from HA to the underlying library it can take a really long time. The better approach is to solve this within HA. Auto detecting the vacuum version instead of setting it in config would be good though but I don't know a way to do that. |
Time isn't an argument for moving logic into home assistant. The library should preferably tell us, somehow, how many speed settings there are per device. |
But the logic is already in home assistant and it works incorrectly. By that logic we should remove the speed dropdown from home assistant and let user enter integer numbers until this is implemented in miio lib. |
No. The library should give us enough information, eg a version or a list of possible speeds, to know the correct interface to use. |
Maybe. But what currently happens is home assistant tries to guess the list of possible speeds and does this wrong. The existing functionality should be either fixed or removed. The current PR will at least allow user to choose the version to fix their UI. |
We should not add a config option for this. |
Well then, leaving this for someone with more spare time to fix |
@poma I'm planning a python-miio release this weekend. Let's move your code there! :-) I will provide some support. |
First we will need some way to automatically figure out which mapping to use for a given vacuum. It could depend on vacuum model, firmware version, or even version of the Mi Home app that user installed on their phone, I don't know. |
Got it. Let's start with your device. ;-) Which model and firmware version do you use? |
Roborock S50, firmware 3.3.9_001710 upd: AFAIK the new mappings should apply to gen 2 vacuum models. Also I've notice that sometimes fan speeds can still use older speed mappings, so when mapping from int to string it should check all mapping versions. |
This is a first draft: rytilahti/python-miio#468 |
This PR has gone stale. Please update the code and open a new PR if you wish to continue with this contribution. |
Description:
Update fan speeds to reflect values that Mi Home app is sending to the vacuum. Tested on Roborock S50, this version correctly reflects values set by the app, and the app correctly highlights speeds set by this component.
To keep backwards compatibility, added a new boolean setting to yaml config -
new_fan_speeds
which defaults to the old fan speed mapping. Maybe someone can suggest shorter and more clear name for new variables.Related issue (if applicable): fixes #17695
Link to an earlier attempt to fix this: #17090
Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#8233
Example entry for
configuration.yaml
(if applicable):Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices: