Xiaomi Vacuum cleaner Card

Thank you very much for this card, I have a noob question, in my case my Xiaomi Vacuum 1S has ben set successfully, however I don’t know how to change in lovelace UI the Mode/fan_speed feature to show Balanced (in this case) instead of 102 or another one set before.

      - type: custom:xiaomi-vacuum-card
        entity: vacuum.xiaomi_vacuum_cleaner
        name: Robot
        vendor: xiaomi
        buttons:
          start: true
          pause: true
          stop: true
          locate: true
        icons:
          start: mdi:play
          pause: mdi:pause
          stop: mdi:stop
        labels:
          status: Estado
          battery: Bateria
          mode: Modo
          main_brush: Cepillo Principal
          side_brush: Cepillo Lateral
          filter: Filtro
          sensor: Sensores

Thanks in advance!

Hi everyone.
I’ve adapted some code found here, but I can’t start, stop, pause, locate the vacuum. Not even start the zoned cleanup from the UI. The drop down is showing, but nothing happens if I select one of the zones.

I’m able to start cleaning a zone from the backend, calling a script manually.

edit:
the vacuum data is read and shown on the picture-elements card.

Hi guys,
I’m totally nub here. Trying to add my xiaomi vacuum cleaner to HA. But seems like HA didn’t see it.
Sone screenshots for example.


What am i doing wrong?
Thank you on advance

Some more pics:

One more:

No way to know without seeing your config.

My configuration.yaml

sensor:
 platform: template
 sensors:
      vacuum_status:
        friendly_name: Status
        entity_id:
          - vacuum.xiaomi_vacuum_cleaner
        value_template: 'Status: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.status }}'
        icon_template: >
          {% set val =  states.vacuum.xiaomi_vacuum_cleaner.attributes.status  %}
          {% if val == 'Charging' %}
            mdi:battery-charging
          {% elif val == 'Cleaning' %}
            mdi:move-resize
          {% elif val == 'Returning home' %}
            mdi:keyboard-return
          {% elif val == 'Idle' %}
            mdi:dots-horizontal
          {% elif val == 'Paused' %}
            mdi:pause-circle
          {% else %}
            mdi:help-circle
          {% endif %}
      vacuum_fan_speed:
        friendly_name: Fan Speed
        entity_id:
          - vacuum.xiaomi_vacuum_cleaner
        value_template: 'Mode: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.fan_speed }}'
        icon_template: 'mdi:speedometer'
      vacuum_battery:
        friendly_name: Vacuum Battery
        entity_id:
          - vacuum.xiaomi_vacuum_cleaner
        value_template: 'Battery: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.battery_level }}'
        unit_of_measurement: '%'
        icon_template: '{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.battery_icon }}'
      vacuum_cleaning_time:
        friendly_name: Time of Last Cycle
        entity_id:
          - vacuum.xiaomi_vacuum_cleaner
        value_template: '{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.cleaning_time }}'
        icon_template: 'mdi:timer'
      vacuum_cleaned_area:
        friendly_name: Area of Last Cycle
        unit_of_measurement: 'm ВІ'
        entity_id:
          - vacuum.xiaomi_vacuum_cleaner
        value_template: '{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.cleaned_area }}'
        icon_template: 'mdi:ruler'
      vacuum_cleanmainbrush:
        friendly_name: Replace main brush
        unit_of_measurement: 'h'
        entity_id:
          - vacuum.xiaomi_vacuum_cleaner
        value_template: 'Main Brush: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.main_brush_left }}'
        icon_template: 'mdi:screwdriver'
      vacuum_cleansidebrush:
        friendly_name: Replace side brush
        unit_of_measurement: 'h'
        entity_id:
          - vacuum.xiaomi_vacuum_cleaner
        value_template: 'Side brush: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.side_brush_left }}'
        icon_template: 'mdi:screwdriver'
      vacuum_cleanfilter:
        friendly_name: Replace filter
        unit_of_measurement: 'h'
        entity_id:
          - vacuum.xiaomi_vacuum_cleaner
        value_template: 'Filter: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.filter_left }}'
        icon_template: 'mdi:screwdriver'
      vacuum_sensordirtyleft:
        friendly_name: Replace filter
        unit_of_measurement: 'h'
        entity_id:
          - vacuum.xiaomi_vacuum_cleaner
        value_template: 'Sensor: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.sensor_dirty_left }}'
        icon_template: 'mdi:screwdriver'
      vacuum_do_not_disturb:
        friendly_name: Do Not Disturb
        entity_id:
          - vacuum.xiaomi_vacuum_cleaner
        value_template: '{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.do_not_disturb }}'
        icon_template: >
          {% set val =  states.vacuum.xiaomi_vacuum_cleaner.attributes.do_not_disturb  %}
          {% if val == 'on' %}
            mdi:do-not-disturb
          {% else %}
            mdi:do-not-disturb-off
          {% endif %}
      vacuum_operation:
        value_template: 'Operation'
      vacuum_accessories:
        value_template: 'Maintenance'

vacuum:
  - platform: miio2
    host: #IP
    token: #mytoken
    name: xiaomi_vacuum_cleaner

input_boolean:
  daily_vacuum_first_run:
    name: Daily Vacuum First Run
    initial: 'off'
  disable_daily_vacuum:
    name: Disable Daily Vacuum Automation
    initial: 'off'
  disable_dustbin_notification:
    name: Disable Dustbin Notification
    initial: 'off'

input_select:
  vacuum_room:
    name: Choose a room to clean
    options:
      - Select Input
      - bedroom
      - guest room
      - dining room
      - kitchen
      - living room

my ui-lovelace.yaml file:

- title: Пылесос 2
  id: vacuum
  icon: mdi:robot-vacuum
  panel: true
  cards:
  - type: picture-elements
    title: Vacuum
    image: /local/vacuum1.jpeg
    elements:
      - type: icon
        icon: mdi:bell-ring
        tap_action: call-service
        entity: vacuum.xiaomi_vacuum_cleaner
        service: vacuum.locate
        style:
         top: 90%
         left: 80%
         color: '#3090C7'
      - type: icon
        icon: mdi:crosshairs
        tap_action: call-service
        entity: vacuum.xiaomi_vacuum_cleaner
        service: vacuum.clean_spot
        style:
         top: 90%
         left: 65%
         color: '#3090C7'
      - type: icon
        tap_action: call-service
        icon: mdi:home
        entity: vacuum.xiaomi_vacuum_cleaner
        service: vacuum.return_to_base
        style:
         top: 90%
         left: 50%
         color: '#3090C7'
      - type: icon
        icon: mdi:stop
        tap_action: call-service
        entity: vacuum.xiaomi_vacuum_cleaner
        service: vacuum.stop
        style:
         top: 90%
         left: 35%
         color: '#3090C7'
      - type: icon
        icon: mdi:play
        tap_action: call-service
        entity: vacuum.xiaomi_vacuum_cleaner
        service: vacuum.start
        style:
         top: 90%
         left: 20%
         color: '#3090C7'
      - type: state-label
        entity: sensor.vacuum_operation
        style:
         top: 10%
         left: 1%
         color: rgb(255, 255, 255)
         transform: translate(0%,-50%)
         pointer-events: none
         font-family: Trebuchet MS
         font-size: 90%
         font-weight: bold
         border-color: rgb(34, 154, 210)
         background-color: '#3090C7'
         border-radius: 6px
      - type: state-label
        entity: sensor.vacuum_accessories
        style:
         top: 10%
         right: 1%
         color: rgb(255, 255, 255)
         transform: translate(0%,-50%)
         pointer-events: none
         font-family: Trebuchet MS
         font-size: 90%
         font-weight: bold
         border-color: rgb(34, 154, 210)
         background-color: '#3090C7'
         border-radius: 6px
      - type: state-label
        tap_action: more-info
        entity: vacuum.xiaomi_vacuum_cleaner
        style:
         top: 14%
         right: 38%
         color: rgb(255, 255, 255)
         transform: translate(0%,-50%)
         font-family: Trebuchet MS
         font-size: 150%
         font-weight: bold
         border-color: rgb(34, 154, 210)
         border-radius: 6px
         background-color: '#cccccc'
      - type: state-label
        entity: sensor.vacuum_cleanmainbrush
        style:
          top: 35%
          right: 1%
          color: '#ffffff'
          transform: translate(0%,-50%)
          pointer-events: none
          font-family: Trebuchet MS
          font-size: 76%
          font-weight: bold
          border-right-style: solid
          border-color: rgb(34, 154, 210)
      - type: state-label
        entity: sensor.vacuum_cleansidebrush
        style:
          top: 45%
          right: 1%
          color: '#ffffff'
          transform: translate(0%,-50%)
          pointer-events: none
          font-family: Trebuchet MS
          font-size: 76%
          font-weight: bold
          border-right-style: solid
          border-color: rgb(34, 154, 210)
      - type: state-label
        entity: sensor.vacuum_cleanfilter
        style:
          top: 55%
          right: 1%
          color: '#ffffff'
          transform: translate(0%,-50%)
          pointer-events: none
          font-family: Trebuchet MS
          font-size: 76%
          font-weight: bold
          border-right-style: solid
          border-color: rgb(34, 154, 210)
          opacity: 0.8
      - type: state-label
        entity: sensor.vacuum_sensordirtyleft
        style:
          top: 65%
          right: 1%
          color: '#ffffff'
          transform: translate(0%,-50%)
          pointer-events: none
          font-family: Trebuchet MS
          font-size: 76%
          font-weight: bold
          border-right-style: solid
          border-color: rgb(34, 154, 210)
      - type: state-label
        entity: sensor.vacuum_status
        style:
          top: 40%
          left: 1%
          color: '#ffffff'
          transform: translate(0%,-50%)
          pointer-events: none
          font-family: Trebuchet MS
          font-size: 80%
          font-weight: bold
          border-left-style: solid
          border-color: '#3090C7'
      - type: state-label
        entity: sensor.vacuum_battery
        style:
          top: 50%
          left: 1%
          color: '#ffffff'
          transform: translate(0%,-50%)
          pointer-events: none
          font-family: Trebuchet MS
          font-size: 80%
          font-weight: bold
          border-left-style: solid
          border-color: rgb(34, 154, 210)
      - type: state-label
        entity: sensor.vacuum_fan_speed
        style:
          top: 60%
          left: 1%
          color: '#ffffff'
          transform: translate(0%,-50%)
          pointer-events: none
          font-family: Trebuchet MS
          font-size: 80%
          font-weight: bold
          border-left-style: solid
          border-color: rgb(34, 154, 210)
      - type: state-label
        entity: sensor.vacuum_cleaned_area
        prefix: "Area:"
        style:
          top: 79%
          left: 31%
          color: '#84a6ba'
          transform: translate(0%,-50%)
          pointer-events: none
          font-family: Trebuchet MS
          font-size: 80%
          font-weight: bold
      - type: state-label
        entity: sensor.vacuum_cleaning_time
        prefix: "Time:"
        style:
          top: 79%
          left: 51%
          color: '#84a6ba'
          transform: translate(0%,-50%)
          pointer-events: none
          font-family: Trebuchet MS
          font-size: 80%
          font-weight: bold
  - type: entities
    entities:
    - entity: input_select.vacuum_room
  - type: glance
    columns: 2
    entities:
    - entity: input_boolean.disable_dustbin_notification
      name: Disable Notification
    - entity: input_boolean.disable_daily_vacuum
      name: Disable Daily Cleanup


what is this miio2 ?
i believe it should be xiaomi_miio

vacuum:
  - platform: miio2
    host: #IP
    token: #mytoken
    name: xiaomi_vacuum_cleaner

tried different options.
for vacuum STYJ02YM saw recommendation to use miio2 instead of xiaomi_miio

Is your token correct? sorry for the obvious quastion but it should be eliminated.
can you attach some log from home assistant?

@yuvalabou i retrieved token via modified mi home and checked lot of times.
Can’t find version of mi home that’s work with mitoolkit to compare tokens.
I hope I’m using correct token.
As i’m newbe here and in HA also could you guide me where i can find necessary log?
Thanks.

If you have a Android phone, You can get token from logfile with version 5.4.54 of Mi Home.

@smurfen With MiToolKit? Or there is another way?

I do not know about Mi Toolkit, but to get the Token that will work with HA, just download the Mi Home specified version as said 5.4.54. Create an account if you not already have, sign in and add your Robot. Check logfile under /sdcard/SmartHome/logs/Plug_Devicemanager/ and you will find the 32-character long Token in the log Token:xxxxxxxx…

@smurfen There is a permanent error while adding vacuum in mi home 5.4.54


But log file were created and token retrieved.
It’s the same with modified version of mi home I used earlier.
So… Seems token used in HA is correct…

Hmm strange, i have a S55 and using another platform.

vacuum:
  - platform: xiaomi_miio

@smurfen i tried different options. xiaomi_miio was first of them. miio2 was uses as was told in github tread github and custom component created by nqkdev custom component

Hello,

After the latest Hass.IO update I’m getting this error in the card:

image

Here’s my configuration:

            attributes:
              battery: battery_level
              filter: filter_left
              main_brush: main_brush_left
              mode: fan_speed
              sensor: sensor_dirty_left
              side_brush: side_brush_left
              status: status
            buttons:
              locate: false
              pause: false
              return: true
              spot: false
              start: true
              stop: true
            entity: vacuum.aspirador
            image: /local/images/vaccum.png
            labels:
              battery: Bateria
              filter: Filtro
              hours: h
              main_brush: Escova
              mode: Potência
              sensor: Sensores
              side_brush: Escova pequena
              status: Status
            name: ' '
            service:
              locate: locate
              pause: pause
              return: return_to_base
              spot: clean_spot
              start: start
              stop: stop
            type: 'custom:xiaomi-vacuum-card'

Any ideas why?
Thanks in advance

Hi,
I have the same problem.
Did you solve it?

Hey.
I try to add this Card to my HA. But im not able to bring it to work.
My Roborock S5 is found by HA and i can see him in the “unused Entity” List.
How do i can use this nice Cards?

At first i have tryed with the manuel installation like in the Readme:


But very fast im at the End of my Knowledge because i dont found the ui-lovelace.yaml.
I have watched a guy on youtube, he copied the Code to the RAW-Editor. I have done the same. Nothing happens…
After this is tryed the installation with HACS. I was able to install the Plugin without Errors, Yeah! :smiley:
But whats the next Step?

Can someone explain it to me in an easy way? I think im a little bit stupid :frowning: