Add Map to Xiaomi vacuum cleaner

Hi @asphalter

Can you please share you code?


Sure, let me a couple of days to clean up a little bit the code :sunglasses:

It’s heavily based on the CodeKing alghoritm and the, and the transfer is done using rsync (sparsify optimized) over SFTP, with minimal effort for the vacuum’s CPU.

Another screenshot from the browser:

As can you probably see the vacuum is running right now, and the map is updating.


maybe u found a way to stop it from rotating a map evrystart ?

Is it needed that the vacuum is connected to the internet ? Wanna block the access for it as it talks too much to China

1 Like

There is no need for it to be connected to the internet, however, you should allow DNS resolving and/or not just drop the packets from it (but instead reject the connections) to avoid timeouts.

1 Like

did you think to maybe just use the or as connection to get the maps.

looking forward to see code. Thx a lot for all the work

Yes, code & setup info would be great. Maybe @stanvx could look into adding this to the HA component. Zoned cleanup would also be a welcome addition.

Looks amazing! We’re definitely looking forward for it! We could stop using altogether the Mi Home application and integrate everything within HA. Anyway the Mi Home app sometimes takes forever to load or their server is down. There have been times it would only to it connect by using a HK VPN.
The only things I use Mi Home for is the for Zoned Clean Up, setting the suction power and the “Go to” command.

Ok, I’ve finally put the things together in my github repository:

Maps to Home Assistant

I hope to see many screenshots with vacuum maps here :rofl:


have you rooted your vacuum? or installed a custom firmware?

Yes, absolutely. The given procedure is only possible with SSH access to the vacuum.

Anyway it’s a quite easy and riskproof procedure, don’t worry for it.

Please feel free to ask if you have further questions.

1 Like

Does it work for v2.?

Btw I got zones cleaning setup and till this morning everything is working fine.need to make a proper writeup . unfortunately I don’t use packages …so u will then find multiple files instead

I read about map getting turned etc. I thing that’s when the app does something strange …to avoid this is just cut all internet for the robot …will provide further feedback after long-term t sting

Hi ThunderGreen,

unfortunately I don’t have a v2 on which I could try this method, but most likely it will work.
The software for v1 and v2 are very similar: on v1 there are many configuration files with disabled v2 options.

Please if someone have a v2 and wants to try to get maps, let us know.

I saw how to copy v2 image in the vacuum … I might give the a try but still not clear for me if it works vacuum is not connected to internet at all

Yes, you can use this method also without any Internet connection to the Xiaomi Cloud.

I’m without any connection to the Cloud too.

The v2 has crypted logs that means the livestream of the map works - but everything else needs improvment. There is also the solution i postet before - there it runs on a extra port with a service and server so you can access it without ssh.

but for both you need a rooted system

now it works to also get the crypted logs - my it is @asphalter interesting for you how it works.

Is there a better write up on how to root the vac? I have spend sometime on the Dustcloud github and still don’t quite understand it. Thanks

I think once it’s finished writing need a clean write-up for home assistant and gather all information together

@kiucheng I followed the guide at: DustCloud - Root HowTo

Below you’ll find the procedure:

Instructions on Linux
These instructions were tested on Ubuntu 14.04 and 17.10 and Fedora 27.

Create the firmware image
Install the required packages: Ubuntu: sudo apt-get install ccrypt git wget Fedora: sudo dnf install ccrypt git             
Create a working directory: mkdir dc && cd dc
Download the dustcloud repository: git clone
Download the firmware image and language data:
For Xiaomi Gen 2 download the latest .pkg from here:
For Xiaomi Gen 1 download the latest .pkg from here:
For both Xiaomi: wget    
Copy your public SSH key to the working directory: cp ~/.ssh/ .
if you don't have SSH keys yet, refer to this guide to create them.
Run the image builder: sudo ./dustcloud/devices/xiaomi.vacuum/firmwarebuilder/ -f 
v11_001228.pkg -k
After the build has succeeded, you are ready to upload the firmware to your vacuum.
Upload the firmware image
This assumes we are still in the working directory from the building step.

Install the required packages: sudo apt-get install python3 python3-pip python3-venv python3-dev 
Create a virtual env for our python packages: python3 -m venv .venv
Enter the virtual env: . .venv/bin/activate
Install wheel so the other packages can be installed successfully: pip install wheel
Install python-miio for communicating with the vacuum: pip install python-miio
Now press the wifi button on your vacuum and join the wifi created by it ('roborock-vacuum-s5_XXXXXXXX' 
or similar).
Use the flasher script to upload the new firmware: python 
dustcloud/devices/xiaomi.vacuum/firmwarebuilder/ -f output/v11_001228.pkg
The update takes several minutes. After the upload is complete, the robot explains that it is now going to 
install an upgrade and restarts when it is complete. Once the robot has successfully restarted, you can 
connect to it via SSH.

@cma0815 thank you for your time watching at my work. I’m glad to help!

I noticed your solution using a dedicated server on the vacuum to serve maps, but I really prefer to serve them over an encrypted, secure and already embedded service. The connection is started FROM the vacuum to avoid the creation of users on the device nor accessing using root user to fetch the maps.

@kiucheng Please try the root procedure and, if you encounter any problem, tell us. We’ll suggest you the right way.

Try and have fun :rofl: