Home Assistant tutorial: integration of Roborock / Xiaomi cards

Home Assistant roborock robot vacuum cleaner xiaomi If we had already offered you, a few months ago, an integration of Xiaomi robot vacuum cleaners in Home Assistant. Very practical and easy to implement, however, it did not take into account the cards and their management by voice with our voice assistants Amazon Alexa and Google Assistant. So today we offer you a full integration of Xiaomi and Roborock cards in Home Assistant !

Follow the guides ...

Compatible robots:

This short tutorial will explain the key steps and important details in order tointegrate your vacuum cleaners into Home Assistant, without drawing a map, with recovery of the real map, monitoring of the robot, etc. without Flolevac which does not support multi-card aspis. And, the highlight of the show, you will also be able to manage your voice animals with Amazon Alexa ou Google Assistant, by rooms, zones, number of passages, and much more ...

Thus, you will be able to define a known part in Xiaomi Home, a recorded zone, chaining rooms or zones, as well as setting the suction power and the number of passages… All in a single script, and therefore with a single sentence to say to your favorite voice assistant!

« Alexa, mop the kitchen " : the script can say, for example, kitchen area + 2 passages + minimum power. Interesting, isn't it?

Note that we are not the devs of the necessary integrations, but enthusiasts who have assimilated the technique and the different manipulations, and we only want to help you by sharing all this!

Table of contents


Yes, you are reading this! No but, it's not just the tutorial that counts!
We have two or three important things to tell you first.
Now you are an adult, you have grown up well, so you understand that all the manipulations you are going to do are under your responsibility!
If your aspi backs up instead of moving forward, if it dances the samba, if it is going to vacuum the bathroom instead of mopping the kitchen, your Home Assistant crashes, or your Raspberry explodes… We don't has nothing to do with it!
All of the following were first installed, tested by us. It works. And we use it every day!
So you take your time, you read well, you don't make the child want to go too fast and skip stages in "Yeah that's good I know!" "
This is not a tutorial on the basics, so some steps are taken for granted and will not be detailed here. There is always the group if you really need help ...

Let's go ?

Do you already have one of the aspis listed above integrated into Home Assistant?

No ? So integrate it, it is essential to continue, by following this superb tutorial: integrate a Xiaomi vacuum cleaner - Roborock to Home Assistant !

Well, you have Home Assistant, an integrated aspi, HACS, File Editor, Internet, a few fingers, and a little time…?

1. Prerequisites / Installation of modules

Here are the two plugins to add via HACS:

  1. Home Assistant Custom Components Xiaomi Cloud Map Extractor
    For this one you have to add the Repository in HACS: (If you don't know how to do this, you go to Configuration / Dashboard / Resources, you click on the "+", you select "JavaScript module" and you paste the url above. Sometimes a "Restart" of Home Assistant is necessary to find it in HACS… Then in HACS, you can find it and install it!
  2. Lovelace Xiaomi Vacuum Map Card : you will find it in the game frontend by HACS.

2. Configuration of card extraction

You will have to use File Editor ou Samba Share to modify your file configuration.yaml, add the configuration below (if you already have "camera:" you don't put it back eh! You stick below ...):

We advise you to use the option "Secret" to hide your passwords, if you don't master you can always write them here anyway ...
Replace our comments with your data!
camera: - platform: xiaomi_cloud_map_extractor host: #! secret xiaomi_vacuum_host to secret to create or replace with the vacuum cleaner ip token: #! secret xiaomi_vacuum_token to secret to create or replace with the vacuum cleaner token username: #! secret xiaomi_cloud_username to secret to create or replace by the email of the mi-home account password: #! secret xiaomi_cloud_password to secret to create or replace with the password of the mi-home name account: # "Vacuum" to name your vacuum cleaner draw: [ 'all'] map_transformation: scale: 2 # to ratio of the image to test according to the size of the desired map rotate: 180 # to rotate 0, 90, 138, 360 degrees of the map trim: top : 10 # à allows to cut the image on the top edge in order to optimize the bottom space: 20 # in allows to cut the image on the bottom edge in order to optimize the left space: # 30 # to allow to cut the image on the left edge in order to optimize the es pace right: 40 # à allows to cut the image on the top right edge in order to optimize the space sizes: charger_radius: 3 vacuum_radius: 4 attributes: - calibration_points - charger - goto - goto_path - goto_predicted_path - image - is_empty - map_name - no_go_areas - no_mopping_areas - obstacles - path - room_numbers - rooms - vacuum_position - vacuum_room - walls - zones auto_update: true

So you have a file that looks a bit like this:

Once the configuration is completed, you must restart Home Assistant.

With each modification made here, a restart of Home Assistant is required. It's up to you to feel for the scale, the trimming, the colors ...
See this page to have all the information and possibilities!

3. Consultation of data from the card

You know, the name you entered in "name:" just before, well a new entity is available camera.Aspirateur_ou_le_nom_que_tu_as_choisi.
Go to Development tool / entity.
And type "camera.Aspirateur_ou_le_nom_que_tu_as_choisi"
You will see the details of the information collected ...
It's scary eh! Don't panic, we're not going to use everything!
Here is an example of the result:

access_token: 4c9e2de29212XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX9358 calibration_points: - vacuum: x: 25500 'y': 25500 map: x: 240 'y': 276 - vacuum: x: 26500 'y': 25500 map: x: 280 'y': 276 - vacuum: x: 26500 'y': 26500 map: x: 280 'y': 236 charger: x: 25505 'y': 25221 goto: null goto_path: null goto_predicted_path: null image: size: 185136 offset_y: 356 offset_x: 390 height: 293 scale: 2 rotation: 0 width: 320 is_empty: false map_name: robomap% 2F117888850% 2F11 no_go_areas: [] no_mopping_areas: null obstacles: null path: point_length: 96 point_size: 4 angle: 0 path: - x: 25547 'y' : 25410 - x: 25570 'y': 25510 - x: 25591 'y': 25606 - x: 25617 'y': 25577 - x: 25666 'y': 25520 - x: 25685 'y': 25506 - x: 25717 room_numbers: - 18 - 16 - 17 - 2 - 3 - 4 rooms: with coordinates of the rooms cut in the xiaomi '2' application: x0: 26700 y0: 22800x1: 34550 y1: 32300 '3': x0: 26050 y0: 23500 x1: 26950 y1: 25300 '4': x0: 25400 y0: 24700 x1: 27000 y1: 26350 '16': x0: 26050 y0: 19700 x1: 30450 y1: 23800 '17': x0: 19500 y0: 22450 x1: 26050 y1: 26450 '18': x0: 19500 y0: 19100 x1: 26900 y1: 23600 vacuum_position: x: 25551 'y': 25394 a: 4294967192 vacuum_room : 4 walls: [] zones: - x0: 25400 y0: 24700 x1: 27000 y1: 26350 friendly_name: Vacuum entity_picture:> - /api/camera_proxy/camera.aspirateur?token=4c9e2dxxxxXX358

4.Display and configuration in lovelace

Create a manual map on the board of your choice.

Here too you pay attention ... You write well what you are told. Watch the next capture if you have any doubts ...

type: 'custom: xiaomi-vacuum-map-card' entity: vacuum.xiaomi_vacuum_cleaner to name of your vacuum cleaner entity "vacuum.xxxx" map_camera: camera.aspirator to name of your camera entity seen just before ... camera_calibration: true to allows to retrieve the automatic calibration language: fr à language of the card modes: - predefined_zones - go_to_target - zoned_cleanup zones: afterwards we explain how to obtain the coordinates - - - 26050 - 23500 - 26950 - 25300 - - - 26700 - 22800 - 34550 - 32300 - - - 25400 - 24700 - 27000 - 26350

…. For all the areas of your choice

To know what to write as digits for an area, two solutions.
But first you add "debug: true" in your map.
This option will allow later, when you click on "start", that a popup gives you the information including the coordinates ...
It is important that you differentiate between rooms and zones.
Rooms: rooms saved in the Xiaomi app
Zones: zones plotted and saved in the Home Assistant card
The coordinates are always a set of 4 numbers, corresponding to these sides:
- law
- high
- left
- bass

The different solutions for recovering coordinates:

  1. Use of the coordinates of the Rooms: you go back to tool DEV, and the entity of your camera.aspixxx and you are looking for the coordinates noted under "Rooms" (these are the parts created in the Xiaomi app).

    You copy each set of 4 numbers for an area in the form indicated in the map ...
    NOTE : we have seen that sometimes these coordinates were not the most exact ...

  2. Use of zones: you click on your nice new card, "mode / cleaning of zones"
    Tu traces an area...
    Tu click on " start-up ", the Popup appears!
    Tu copies every number in the form shown. (The last isolated figure will not be useful to you here…) "Example of display of the pop-up for the selected zone"
  3. You check by clicking on your nice new card, "Mode / zones", all that is recorded!
  4. You can now change the value of "Debug" with "false" when you're done.

Here is the result with the different zones and with two zones selected (green)

5. Automation or script for cleaning by room or zone.

You remember the difference between Rooms et areas ?

Because we are not going to call the same service for everyone, only the service " Zone " will also allow you to choose the number of passages !


To create an automation or a script allowing the cleaning of a defined area, you must call the following service:

service: xiaomi_miio.vacuum_clean_zone data: zone: # -> coordinates of the zone as inserted in the map - - 27333 - 28810 - 28777 - 33623 repeats: 2 # -> desired number of repetitions entity_id: # vacuum.xiaomi_vacuum_cleaner

This is the line "Repeats:" which determines the number of passages, 3 max!

You can of course chain the zones in the same script, respecting the formatting of the coordinates.


And how to use the parts of the Xiaomi app? We explain that to you!

To carry out an automation or a script allowing the cleaning of a room recorded in the Xiaomi app, you must
First go back to DEV tool, camera entity.aspi… Do you see what we're talking about now?
There you are looking for the rooms_number.
Each number corresponds to a part, you will see which part corresponds to a number by sending to work your aspi!
In DEV tool "service" tab you open the "vacuum.send_command" service and you fill in like this:

entity_id: vacuum.wall_e command: app_segment_clean params: - 23

Look on the map, even from the Xiaomi app regardless, where it is going and which room is highlighted… Bingo! You have the correspondence! Stop him, he'll go around in circles enough while you do each number, don't tire him for nothing!

Make yourself a script like this, with the same service we just used, imagine that this is my kitchen, I do this:

aspi_walle_cuisine: alias: Aspi walle cuisine sequence: - service: vacuum.send_command
    data: entity_id: vacuum.wall_e command: app_segment_clean params: - 23 entity_id: vacuum.wall_e

After refreshing your scripts, you will find it under the name "Aspi walle cuisine" for this example!
You can chain the rooms number in the same script!


aspi_walle_couloir: alias: Aspi walle corridor and entry sequence: - service: vacuum.send_command
    data: entity_id: vacuum.wall_e command: app_segment_clean
      params: - 25 - 18 entity_id: vacuum.wall_e

Only problem, no repetition possible for the numbers of passages.


Now that you are there, you can mix the commands in one script for too manage the suction power from almost zero in mop mode… to very strong!

  • Gentle
  • Silent
  • Standard
  • Medium
  • Turbo

Call the service "Vacuum.set_fan_speed" for that.

And mix!

Personal example, I want two passages for my kitchen, because it is dedicated to the mop, with minimum power:

aspi_walle_serpille_cuisine: alias: Aspi walle kitchen mop sequence: - service: vacuum.set_fan_speed
    data: fan_speed: Gentle entity_id: vacuum.wall_e - service: xiaomi_miio.vacuum_clean_zone data: zone: - - 23761 - 28734 - 27308 - 31571 repeats: 2 entity_id: vacuum.wall_e mode: single

It's up to you to write as many scripts as you need…

6. Voice Assistants

The scripts are finished?

Well inject them in Alexa or Google, and enjoy !!!

There are 4 solutions in order to integrate voice assistants into Home Assistant but this is not the subject of this tutorial.

We assume that your Home Assistant is connected to Amazon Alexa or Google Assistant!

7. Alexa via the Nabu Casa subscription (and Google Assistant)

I'm talking about this method here being the one I use, my accomplice tells you about the Google method without Nabu Casa just after!

Of course you integrated Alexa, otherwise come back after…! If you haven't found the link, look over there!

Go to: Setup / Cloud Home Assistant / Alexa / Manage entities


You select the ones you want to inject (logical ...!): "Exhibit the entity"

Go back and you validate "Synchronize entities" !


Normally you instantly receive a notification of your application Alexa like what new things have happened ...

Yes, open the app Alexa !

Where do you find it all?

Two seconds, I'll explain… I don't write as fast as you read!

You go create a new routine Alexa.

And in actions you will seek "Connected home"then "Control a scene".


All your scripts, automations are there!

All you have to do is choose the right one, and write yourself a little trigger phrase.

For my part, having tried without success "Pass the asp", I have chosen "Vacuum in xx" ou "Mop in xx".

Hint: in your application Alexa (or Google Home), do not register your robot in a stylish room " salon " ! Because « Alexa light up the living room " go trigger your robot and you're gonna moan again cause it's too loud while you're watching your show, and the kids are sleeping, and you're gonna say "It's their fault with their tutorial of…. ". Except no, make a piece like "Aspi" and stick it there. You will thank us!

8. Google Assistant without a Nabucasa subscription

1. In the configuration.yaml, you must add the script (s) under the following block (if you don't have this block of code, you have not read the instruction):

google_assistant: secure_devices_pin: XX project_id: yyyy-XXX service_account:! include yyyy-XX.json report_state: true exposed_domains: - switch - light - vacuum - cover - alarm_control_panel entity_config: to only modify the list below in order to add your scripts script.aspirateur_kitchen: to the script name created exposes: true

2. Save the file configuration.yaml

3. Restarts Home Assistant to take the new setting into account.

Wait for Home Assistant to restart completely before yelling "OK Google, synchronize my devices" because you are in a hurry to test the new functionality!

Dance Google Home, you should see the scripts appear ...

Hint: do not associate the scripts with the part concerned in Google Assistant. Otherwise you risk seeing your favorite vacuum cleaner dancing when you ask your Nest audio to light up the living room to drink your beer, quietly installed on your sofa.

9. Personal feedback

Since we use this method, I use 90% of my voice assistant.

I differentiated the sentences:

  • "Vacuum the ..." : 1 standard power passage (room);
  • "Mop the floor in ..." : 2 passages (zones) soft power.

I also have the voice commands to pause and return to base. The whole fact that the robot is really controllable by voice, to measure. Everyone can now pass the vacuum, even children!

10. The last word

How to integrate Roborock and Xiaomi robot vacuum cards into Home AssistantHere is the end of this little one Home Assistant tutorial which, we hope, will have helped you as best as possible!

We realized it with pleasure, in a spirit of mutual aid, on a voluntary basis, in parallel with our jobs and our lives (yes, we have some!).

We don't support all issues, but we'll be there on the band if needed, as usual.

If everything works, thank me! But otherwise, it is necessarily his fault. Who is writing ? Him or me. Right now ? Of course me, sometimes him.

Two passionate friends, Yann Ritter and Aurel RV.

Passionate about technology, I discovered the world of Smart Home with Xiaomi, then Alexa and Les Alexiens led me to become passionate about Home Assistant, which I master better every day!