Core: Xiaomi vacuum V2 fan speed is not mapped correctly

Created on 22 Oct 2018  路  16Comments  路  Source: home-assistant/core

Home Assistant release with the issue:
0.80.3

Last working Home Assistant release (if known):
-

Operating environment (Hass.io/Docker/Windows/etc.):
Hass on raspberry pi 3b+

Component/platform:
Xiaomi Mi Robot Vacuum
https://www.home-assistant.io/components/vacuum.xiaomi_miio/

Description of problem:
Fan speed are not mapped correctly for the Xiaomi vacuum V2 Correct values are:
Quiet: 101
Balanced: 102
Turbo: 103
Max: 104
Mop: 105

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

vacuum:
  - platform: xiaomi_miio
    host: !secret xiaomi_vacuum_host
    token: !secret xiaomi_vacuum_token

Traceback (if applicable):


Additional information:

in progress xiaomi_miio problem in dependency stale

All 16 comments

See my comment in #17090 - this needs to be fixed in the upstream library (PRs welcome!).

It is not a problem - only that Mop is missing.
Xiaomi App started using the 101+ values, but you can still use 0-100 that sets the speed percentually.
90 = 90% speed.

But it is not an issue for the underlying library because it doesn't know about the speeds and it doesn't enumerate them, it just set them by integer value. HA is enumerating the speeds and using library to set them to certain integer value. That would be brand new feature for underlying library to know which type of vacuum it is communicating with and the PR would also need to change the API because now the underyling library would be doing the enumeration of speeds. And then we would also need to change HA.

I agree with @drndos, this feature might take a very long time to be implemented in the underlying library.

As a faster fix, we could add a flag in the component yaml config, telling it which mapping it should use (old or new)

@poma
You can actually call service with correct ID in home-assistant so if you create your own GUI it will work. Sample:

elements:
  - type: icon
    style:
      top: 10%
      left: 62%
    icon: 'mdi:clock-outline'
    tap_action: none
  - title: Cleaning time
    style:
      transform: none
      top: 3%
      left: 63%
      color: black
    type: state-label
    entity: sensor.vacuum_cleaning_time
  - type: icon
    style:
      top: 10%
      left: 76%
    icon: 'mdi:border-none-variant'
    tap_action: none
  - title: Cleaned area
    style:
      transform: none
      top: 3%
      left: 77%
      color: black
    type: state-label
    entity: sensor.vacuum_cleaned_area
  - type: icon
    style:
      top: 10%
      left: 89%
    icon: 'mdi:battery'
    tap_action: none
  - title: Battery level
    style:
      transform: none
      top: 3%
      left: 90%
      color: black
    type: state-label
    entity: sensor.vacuum_battery_level
  - icon: 'mdi:play'
    type: icon
    service: vacuum.start
    style:
      top: 81%
      '--iron-icon-height': 60px
      '--iron-icon-width': 60px
      left: 25%
    entity: vacuum.xiaomi_vacuum_cleaner
    tap_action: call-service
  - icon: 'mdi:pause'
    type: icon
    service: vacuum.pause
    style:
      top: 81%
      '--iron-icon-height': 60px
      '--iron-icon-width': 60px
      left: 40%
    entity: vacuum.xiaomi_vacuum_cleaner
    tap_action: call-service
  - icon: 'mdi:stop'
    type: icon
    service: vacuum.stop
    style:
      top: 81%
      '--iron-icon-height': 60px
      '--iron-icon-width': 60px
      left: 55%
    entity: vacuum.xiaomi_vacuum_cleaner
    tap_action: call-service
  - icon: 'mdi:home-map-marker'
    type: icon
    service: vacuum.return_to_base
    style:
      top: 81%
      '--iron-icon-height': 60px
      '--iron-icon-width': 60px
      left: 70%
    entity: vacuum.xiaomi_vacuum_cleaner
    tap_action: call-service
  - style:
      font-weight: bold
      font-family: Trebuchet MS
      top: 10%
      background-color: 'rgb(54, 65, 78)'
      border-color: 'rgb(34, 154, 210)'
      pointer-events: none
      opacity: 0.8
      font-size: 90%
      color: 'rgb(255, 255, 255)'
      border-left-style: solid
      transform: 'translate(0%,-50%)'
      text-shadow: 1px 1px black
      left: 5%
    entity: sensor.vacuum_status
    type: state-label
  - service_data:
      fan_speed: 105
      entity_id: vacuum.xiaomi_vacuum_cleaner
    icon: 'mdi:water'
    type: icon
    tap_action: call-service
    style:
      top: 28%
      '--iron-icon-height': 30px
      '--iron-icon-width': 30px
      left: 65%
    entity: vacuum.xiaomi_vacuum_cleaner
    service: vacuum.set_fan_speed
  - service_data:
      fan_speed: 101
      entity_id: vacuum.xiaomi_vacuum_cleaner
    icon: 'mdi:power-sleep'
    type: icon
    tap_action: call-service
    style:
      top: 28%
      '--iron-icon-height': 30px
      '--iron-icon-width': 30px
      left: 73%
    entity: vacuum.xiaomi_vacuum_cleaner
    service: vacuum.set_fan_speed
  - service_data:
      fan_speed: 102
      entity_id: vacuum.xiaomi_vacuum_cleaner
    icon: 'mdi:fan'
    type: icon
    tap_action: call-service
    style:
      top: 28%
      '--iron-icon-height': 30px
      '--iron-icon-width': 30px
      left: 81%
    entity: vacuum.xiaomi_vacuum_cleaner
    service: vacuum.set_fan_speed
  - service_data:
      fan_speed: 103
      entity_id: vacuum.xiaomi_vacuum_cleaner
    icon: 'mdi:blender'
    type: icon
    tap_action: call-service
    style:
      top: 28%
      '--iron-icon-height': 30px
      '--iron-icon-width': 30px
      left: 89%
    entity: vacuum.xiaomi_vacuum_cleaner
    service: vacuum.set_fan_speed
  - service_data:
      fan_speed: 104
      entity_id: vacuum.xiaomi_vacuum_cleaner
    icon: 'mdi:weather-hurricane'
    type: icon
    tap_action: call-service
    style:
      top: 28%
      '--iron-icon-height': 30px
      '--iron-icon-width': 30px
      left: 97%
    entity: vacuum.xiaomi_vacuum_cleaner
    service: vacuum.set_fan_speed
  - style:
      font-weight: bold
      font-family: Trebuchet MS
      top: 25%
      background-color: 'rgb(54, 65, 78)'
      border-color: 'rgb(34, 154, 210)'
      pointer-events: none
      opacity: 0.8
      font-size: 90%
      color: 'rgb(255, 255, 255)'
      border-left-style: solid
      transform: 'translate(0%,-50%)'
      text-shadow: 1px 1px black
      left: 5%
    entity: sensor.vacuum_fan_speed
    type: state-label
id: db5e323abd984551a8db5a0bf4721da8
image: /local/vacuum_card.jpg
type: picture-elements

image

For myself I've just made an override .py file with the correct mapping, only had to change a few numbers. I'll make a PR because I want it to work for other users out of the box.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

mapping is still wrong.

Just for the record, @bugficks created a PR to fix this issue in the backend library (https://github.com/rytilahti/python-miio/pull/523), but closed it afterwards out of no interest.

@rytilahti Maybe do a shot at moving it forward nevertheless?

well if there is no response to a pull request after a week that shows me there is no interest, hence I have closed the pull request. simple as that.

@bugficks A week? I'm sorry sir, but that is not uncommon in the open source world. Furthermore, I personally don't see why one should close PR because of "waiting" too long. But that is personal I guess :)

@frenck if you say so :) I'm used to some sort of reply within a few days. My fork is still available for now and if someone had asked to reopen PR I would have done so.

Sorry for not being responsive enough, I've seen the PR and it looks good from the surface, but I haven't unfortunately have had enough time to dig into the specifics nor do I have currently access to test it myself.

As I cannot test it myself, I'm really hesitant on simply merging it and pushing out a new release (in case it then breaks down on someone's setup). So if anyone is willing to do some testing (verifying that everything works just fine also with the v1 vacuum), I think we can go ahead, merge that PR and I can prepare a new release so we can finally get that fixed.

If there are no volunteers I will be doing that by myself when I'll get access to a device later this year (some point in October). As I hope it doesn't have to wait that long, I hope that some other people will do testing on it and report on that PR :-)

If there are no volunteers I will be doing that by myself when I'll get access to a device later this year (some point in October). As I hope it doesn't have to wait that long, I hope that some other people will do testing on it and report on that PR :-)

Hi! I just start the jurney with HA and I really want help with the MOP functions. I create special area to clean with mop and now I need to change normal mode to mop :D

How can I help You with that?

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kirichkov picture kirichkov  路  3Comments

Elmardus picture Elmardus  路  3Comments

piitaya picture piitaya  路  3Comments

bdraco picture bdraco  路  3Comments

aweb-01 picture aweb-01  路  3Comments