Add Map to Xiaomi vacuum cleaner

I can give u an app (Russian modification) to read out the token …just let me know

https://cloud-space.ddns.net/r/B70GuiSe#aQlneJNuOu+FIeQmhmXmek7intD3OfMexmgMlEMxfJ8=

Here is the app

I tried using the “Miio command line tool” but it doesn’t show the token on the MiRobot. Is this normal?

Anyway will try your apk. Doesn’t sound particularly safe, so i’ll try it on spare device :wink: Thanks for the link, I’ve now got my new token.

I’ll try pushing up the firmware by specifying the IP address and Token, see what happens.

1 Like

Thanks @thundergreen, @Skeletorjus and @lolouk44 for helping me to root my MiRobot. For everyone’s benefit the detailed steps I took (from scratch) are as below:

Instructions on how to root MiRobot using Ubuntu Virtualbox VM

Setup

  1. Ensure you have the IP Address and Token for your MiRobot.
  • The official instructions to get the token are on this page, however if you’re looking for a easy solution for Android this post will give you a modified MiHome Android App that will show the Token in the MiRobot’s Network information page. When i tested it the link was for version 5.4.14 (it continually gets updated)
  • You’ll know you have the correct Token and IP address if you Home Assistant YAML file is successfully integrated for the MiRobot
  1. Install the latest version of Virtualbox
  2. Download Ubuntu v16 http://releases.ubuntu.com/16.04/
  3. Setup a Linux VM on VirtualBox and Install Ubuntu v16. Ensure:
  • Network is configured as a “Bridge Adapter”. If you don’t do this the webserver to upload the firmware to the MiRobot will fail.
  • the ISO file you just downloaded is mounted as a CD for install

Create the firmware image

  1. Run the Terminteral
  2. Install the required packages: Ubuntu: sudo apt-get install ccrypt git wget
  3. Create a working directory: mkdir dc && cd dc
  4. Download the dustcloud repository: git clone https://github.com/dgiese/dustcloud.git
  5. Download the firmware image and language data:
  1. Copy your public SSH key to the working directory: cp ~/.ssh/id_rsa.pub .
  • if you don’t have SSH keys yet, refer to this guide to create them.
  1. Run the image builder: sudo ./dustcloud/devices/xiaomi.vacuum/firmwarebuilder/imagebuilder.sh -f v11_003254.pkg -k id_rsa.pub
  2. 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.

  1. Install the required packages: sudo apt-get install python3 python3-pip python3-venv python3-dev
  2. Create a virtual env for our python packages: python3 -m venv .venv
  3. Enter the virtual env: . .venv/bin/activate
  4. Upgrade pip: pip install --upgrade pip
  5. Install wheel so the other packages can be installed successfully: pip install wheel
  6. Install python-miio for communicating with the vacuum: pip install python-miio
  7. Use the flasher script to upload the new firmware (for the XXX values use the IP address and Token from the very first step): python dustcloud/devices/xiaomi.vacuum/firmwarebuilder/flasher.py -f output/v11_003254.pkg -a X.X.X.X -t XXXXX
  8. 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.
  • For me the final step’s upload failed to get to 100% on multiple occasions. I restarted both the MiRobot and the Ubuntu VM and then it was successful. When it hits 100% you’ll hear the MiRobot say “upgrading firmware this should take 5 to 10 minutes” and once upgrade is finished it’ll play music then say “charging” if it’s in the dock. If you check you MiHome app the firmware should now be v3254 (or whatever version you used)
8 Likes

Using the Gen 1 v3254 rooted firmware and I find its not very good at managing suspended wheels. The mirobot just spins its wheels endlessly when it has mounted a high rug or a piece of Lego. It’s so bad it’s started leaving wheel scratch marks on the floorboards.

I can’t seem to compile any firmware versions newer than v3254. Can anyone advise if they’ve been able to get a newer firmware rooted on the v1 mirobot?

Please be advised that newer firmware risk to break downgrading and will certainly remove root. It’s not clear for the moment if the robot can be rooted with newest firmware. Be attentive updating the firmware

My guess is that you’re using v3254 also. Though it’s possible downgrading may be stopped in future, I’ve updated to v3416 (with no root) and have been able to downgrade so far.

At this time i’m forced to choose between wheel scratch marks on my floorboard when the MiRobot mounts and object and gets partially suspended or an updated firmware that has no live map integration with Home Assistant (all the other features still work with Home Assistant).

Thank you for your post. All works fine, but not the SSH access… first time that I tried to access I inserted the “root” user, but the ssh ask me for a password. I think that the issue is when I created the ssh keys, please could you tell me how to proceed step by step on the creation of the id_rsa.pub? I need to create a passphrase for example? then on agent, I need to change something? (i use the putty client to access into the ssh)
thank you in advance

do steps 1-4 in this above link. The password you set is what you’ll use for the root password when SSH into the mirobot.

thank you for your reply. I follow this step 3 times but I don’t know if on my client (putty on Windows 10) I need to load the certificate or not.

The first time that I try to access on ssh into my vacuum, I can open the ssh connection, but when type “root” for the user and type the password, the ssh tell me that the password is bad…
After 2-3 retry, I can’t reconnect on ssh into the vacuum and I need to reupload the custom firmware.

Hello,

I have Hassio installation of home assistant. Can i use this script with it? I can use custom components with it, is this the same?

Thank you!

Actually I’ve noticed something similar. For me if I use the Ubuntu VM that was used to run the steps I can SSH in no problems. Try that.

Have you managed to get this on Hassio installation?

I have rooted the vacuum, copied the files, changed the permissions on it and I can SSH into it… however I can’t figure out the Hassio Home Assistant part.

I don’t think we can install incrond or python-pillow on Hassio, so how?

Well that is also what i am asking… I still don’t have the vaccum yet!

I have Hassio HA and the vacuum, however I can’t figure out how to get this working. Any advice is greatly appreciated so maybe both of us can get going with this…

As per @asphalter guide, do we need incrond? Can we use the following component for build_maps.py without incrond?

Not a Linux/Python guy so I am basically doing a trial and error methodology, and searching for the stuff I don’t know how to do like all the vacuum rooting thing.

We can assume you’re using a RedHat like system (CentOS, Fedora, RedHat, SuSe, …) as destination host.

  • Ensure that you’ve installed python-pillow package. On RedHat like systems you can issue the command yum install python-pillow
  • Ensure that you’ve installed incrond package. On RedHat like systems you can issue the command > yum install incron
  • Copy vacuum/etc/incron.d/vacuum_maps to /etc/incron.d/vacuum_maps.
  • Create the directories /home/homeassistant/.homeassistant/scripts , /home/homeassistant/.homeassistant/www , /home/homeassistant/.homeassistant/vacuum if not exist.
  • Make sure to fix the ownership of these directories to the user homeassistant .
  • Copy the script homeassistant/home/homeassistant/scripts/build_maps.py to /home/homeassistant/.homeassistant/scripts/build_maps.py.
  • Copy the script homeassistant/home/homeassistant/scripts/incrond_vacuum_maps.sh to /home/homeassistant/.homeassistant/scripts/incrond_vacuum_maps.sh.
  • Make sure to give to the file the right permissions with the command: chown 755 /home/homeassistant/.homeassistant/scripts/incrond_vacuum_maps.sh .

Actually i will try with this i don’t know if i will be able to install that but…

https://developers.home-assistant.io/docs/en/hassio_debugging.html

@gurbina93 and @SoulSlayer I’m running my MiRobot this on a hassio. For the live maps component I’m running with a Valetudo service running on the Mirobot.

I’ll post up steps on how I did it shortly.

2 Likes

Wow that would be very nice a little tutorial! Thank you!

Guys , I’d love to have maps in HASS also, did someone try to root xiaowa e20/e35 vacuum, which I have ?

Instructions to install and configure Valetudo Live Map on a rooted MiRobot

Ok, once you’ve rooted the MiRobot the steps below will get you a Live Map into Home assistant using Valetudo.

Install and Start Valetudo on the MiRobot

  1. Open up the the Terminal run the below commands
  2. mkdir valetudo && cd valetudo This will create a folder on your Linux VM for you to download the needed packages
  3. wget https://raw.githubusercontent.com/Hypfer/Valetudo/master/deployment/valetudo.conf
  4. wget https://github.com/Hypfer/Valetudo/releases/download/0.0.7/valetudo use a newer version of Valetudo if one exists
  5. scp valetudo [email protected]:/usr/local/bin/ (This copies the downloaded files to the MiRobot. Use the IP of the MiRobot & the password you set as your SSH key when building your firmware)
  6. scp valetudo.conf [email protected]:/etc/init/
  7. ssh [email protected] SSH into the MiRobot
  8. chmod +x /usr/local/bin/valetudo
  9. service valetudo start
  10. You should now be able to see Valetudo WebServer if you enter the IP address of your MiRobot into a web browser

Configure the Valetudo Live Map into your Home Assistant

  1. Follow this post’s instructions: Valetudo - Xiaomi Vacuum Dustcloud alternative, Live Maps
7 Likes

Thanks to share this …a small idea from me what u can do with rooted robot and hadashboard