core: Xiaomi vacuum V2 fan speed is not mapped correctly

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:

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

@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 😃

@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

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.

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.