The Xiaomi Robot Vacuum, Home Assistant, and Alexa

**This post will cover setting the Xiaomi Mi Robot Vacuum up to work with Home Assistant. If you don’t use Home Assistant and want to control your vacuum with only your Alexa device, go here.**

I recently splurged and got myself a robot vacuum and I think it’s been the best purchase I’ve made in my adult life. I work full time and go to school, so the fewer chores I have to do, the better. Now, I can just dust the counters and flat surfaces off onto the floor and when I get back from work I come home to a cleaner apartment. While this purchase cost more than the rest of my gadgets combined, that’s not saying too much since I am using my $200 Smart-Home set up. It is arguably the most useful of any of my Smart-Home devices.

There are so many Robo-vacuums available right now, that it was hard sifting through the different options. I had to do a fair amount of homework searching for the right one and I think I found it in the Xiaomi Mi Robot Vacuum. I have been very impressed with the Xiaomi brand since I started using their Smart-Home Gateway and Sensors; my experience with their vacuum is no different. It is user friendly, it feels like a solid piece of technology, it looks sleek and clean, and it works like a champ! Most importantly, it is compatible with Home Assistant, an open source Home Automation platform that I use.

This guide includes:

  1. Unboxing the Xiaomi Mi Robot Vacuum
  2. Setting the vacuum up with the Mi Home App
  3. Making the vacuum speak English, and changing the vacuum’s name
  4. Getting the vacuum’s Access Token using Windows and an Android device
  5. Integrating the Xiaomi Vacuum component in Home Assistant
  6. Adding the vacuum to Home Assistant’s front end & configuring it to work with Alexa
  7. Extra Parts and Accessories

Unboxing the Xiaomi Mi Robot Vacuum

Unboxing the vacuum is easy. It comes ready to use, you’ll just want to charge it up a little more before attempting a full vacuum. There was enough juice in it to mess around with it for a little bit first, though, which was fun.

The box contains:

  • The Xiaomi Mi Robot Vacuum
  • The Charging Station
  • A Brush Cleaner
  • Set up Instructions

Setting Up the Vaccuum

  • The first thing you’ll want to do, is get the vacuum connected using the Mi Home App.
    • The current app does not make the Access Token available to us.
    • You will need to download an older version of the app.
    • Mi Home 5.0.0 is what I used, and can be found here.
      • Use the Mainland China servers
  • Log in to the app or create a new account.
  • The app may discover the vacuum on it’s own, if not, select the “+” in the top right corner, select the vacuum from the options, and follow the instructions.

Screenshot_2018-03-18-13-22-23

Now that your Xiaomi Mi Robot Vacuum is set up, you can use it from the app. Click on the Vacuum from your app and agree to the terms provided. The blue area will populate with a map as the vacuum uses its IR sensor to scan the area.

The bottom of the screen has 3 buttons:

    • Dock- Will send the vacuum back to the dock to charge
    • Clean – Will begin the cleaning process
    • Speed- You can cycle through 4 different settings
      • Quiet
      • Blanced
      • Turbo
      • Full Speed

  • When doing a cleaning, you can follow along in the app.
  • The vacuum will create a map and show you what has been cleaned.
    • It will create a new map each time it runs and show you where it has cleaned.
  • This vacuum requires a 4″ clearance to fit underneath any furniture.

Make the Vacuum Speak English & Change its Name

Now, it’s likely that the vacuum has been speaking Chinese to you throughout the setup process. You can easily change the vacuum’s voice pack to English.

  • From the vacuum screen, click the settings icon in the top right corner
  • Choose “Vacuum Settings”
  • Select “Voice Pack”
    • On the bottom of this page you should be able to choose “English: female voice”
  • Go back to the “Settings” page. While you’re here in the settings, it would be a good time to change the name of the vacuum.
    • Choose “General Settings”
    • Select, “Rename.”

Get the Vacuum’s Access Token, Using Windows and An Android device

Since my last post, my computer died. Up until this point I had been using an old MacBook that I’ve had forever. I’ve switched over to Windows, and it turns out to have been good timing. What seems to be the easiest method for grabbing the vacuum’s token is done with Windows and an android device. Other methods can be found on the Xiaomi Mi Robot Vacuum’s Home Assistant component page.

  • The first step in accessing the vacuum’s token is to download MiTookKit.zip.

1

  • Unzip this file and open MiToolKit.

3

  • Once opened, you’ll notice it is in German, you can click on the little flag at the bottom to switch it to English.
  • Click the Extract Token button.

13

  • There are a couple of requirements you’ll notice that need to be fulfilled before you can use this application.
    • First, activate USB debugging on your Android device.
    • Second, make sure you’ve got Java installed.
    • Lastly, connect your Android to your computer & open the Mi Home app.

5

  • Now, extract the token from your Android.
    • Your token MUST have numbers and letters. If it is only numbers, it will not work. To get a new token, just delete the vacuum from the app and re-add it in.
    • I used the Mainland China server in the Mi Home App
    • If you are only getting the IP address for the vacuum, you are using an updated version of the app. Make sure to use the 5.0.0 version.
    • Don’t set a password for the backup being created
    • You can see the application pulled all of the tokens from my other Xiaomi and Yeelight devices.

Connect the Xiaomi Vacuum to Home Assistant

**Be Aware, Home Assistant 0.62 broke the Miio platform used for the vacuum, which was fixed in version 63.3. Make sure you are using an appropriate version of Home assistant. I used 65.5 when I made this post.**

So, you’ve snagged your token… now what? Start by opening your configuration.yaml file.

code1

  • Add this to your configuration file and save.
    • The name is optional.
  • Be sure to check your configuration in the configuration tab before restarting Home Assistant.

Vacuum State

  • Now you should be able to see your Xiaomi Mi Robot Vacuum in the States page.
    • Notice mine says “vacuum.robovac” based on the name I used in my configuration.
      • By default, this would be “vacuum.xiaomi_vacuum_cleaner”

Adding the Vacuum to the Home Assistant Front End

Vacuum in status

  • You can add your vacuum to your front end by adding “vacuum.YOUR_ROBOT_NAME” to any of your groups.
  • You can use any of the attributes on the “States” page as individual sensors. You can do this with a sensor template added to your sensors.yaml, like this:

  • I started going this route, then realized if you click on the vacuum component, it’ll show you all the good stuff and give you some extra control beyond the on/off switch.

robo vac card

  • This card gives you Start/Pause, Stop, Spot Clean, Locate Vacuum, and Return Home
  • You can also control the fan speed from here
  • The ‘do not disturb’ times, are ones that I set from within the Xiaomi Mi Home app
  • Main brush left, side brush left, and filter left refer to how much longer (in cleaning hours) before that part needs to be replaced
    • Be aware, the Mi Home app also has a countdown to when it is necessary to clean the sensors, this is not included here, but should be considered in order to maintain your vacuum.
  • Now you’re all set… right? NO! Well, not me anyway. I wanted to also be able to control the vacuum through Alexa. Unfortunately, adding the vacuum to the rest of the switches did not work because it is a vacuum component and not a switch component. So I had to make a switch that Alexa CAN control using the switch template.
  • Open your configuration.yaml or switches.yaml; wherever you keep your switch components.

code2

  • Add this switch to your configuration, be sure to replace “robovac” with the name of your vacuum.
  • Now add “switch.vacuum” to the rest of your Alexa accessible entities.
  • Make Alexa find your devices, and you should see the new vacuum switch!
    • The on command will start the cleanup and off will return it to the dock.
  • One more addition I did for fun was a script to find the vacuum.

code3

  • Add “script.find_vacuum” to the rest of your Alexa accessible entities.
    • After it’s added, you can create an Alexa Routine inside the Alexa app to find the vacuum!

Screenshot_20180320-195754.png

Screenshot_20180320-200145.png

We’ve covered how to connect the Xiaomi Mi Robot Vacuum to the (older version) Mi Home app, extract the Token from the app, and add the Xiaomi Vacuum to Home assistant. You can now also control the vacuum through the app, Home Assistant, and Alexa (by using a switch template). Lastly, you can also find the vacuum by asking Alexa, “where’s the vacuum?” I’ve really enjoyed my short time with the Xiaomi Mi Robot Vacuum and think you will too. My Smart-Home feels so much smarter now! If these guides have been helpful to you, please share them! If you have any questions, please reach out to me in the comments. Thank you for visiting!

Extra Parts & Accessories

The vacuum’s consumable pieces (main brush, side brush, and filters) can be purchased in different kits or individually. The only extra accessory for the vacuum that doesn’t come with the vacuum is the Mi Invisible Wall. Some options are available on Amazon, some Gearbest, and some on both. The vacuum itself is also available from both sellers. I’ve provided some links below.

Gearbest Xiaomi Mi Robot Vacuum

Xiaomi Mi Robot Vacuum

Amazon GearBest

Gearbest 5 piece Mi Robot Vacuum Smart Cleaner Accessories

5 piece Mi Robot Vacuum Smart Cleaner Accessories

GearBest

Original accessories For XIAOMI MI Robot Vacuum

Gearbest Robotic Vacuum Cleaner Filter for Xiaomi

Robotic Vacuum Cleaner Filter for Xiaomi (Individual)

Amazon GearBest

HEPA Filter accessories For XIAOMI MI Robot Vacuum cleaner (2 Pack)

Gearbest Robotic Vacuum Cleaner Rolling Brush for Xiaomi

Robotic Vacuum Cleaner Rolling Brush for Xiaomi

Amazon GearBest

Gearbest Robotic Vacuum Cleaner Side Brushes for Xiaomi

Robotic Vacuum Cleaner Side Brushes for Xiaomi

GearBest

Gearbest Robotic Vacuum Cleaner Rolling Brush Cover for Xiaomi

Robotic Vacuum Cleaner Rolling Brush Cover for Xiaomi

Gearbest Mi Invisible Wall for Xiaomi

Mi Invisible Wall for Xiaomi

BLENDX Boundary Markers for Neato Botvac Series Neato and Shark ION Robot Vacuum, Alternative accessories magnetic strip tape for xiaomi vacuum, 13 Feet

4 thoughts on “The Xiaomi Robot Vacuum, Home Assistant, and Alexa

  1. Great write up from start to finish, it greatly helped me to set mine up – thanks, I wish more Home Assistant “walk through”s were this good.

    Like

    1. Thank you so much! What a great compliment! I’ve got more to share regarding the Xiaomi Vacuum. I’ve worked out how to send it to individual rooms within Home Assistant. It might take some time for me to get the walkthrough put together, but in the meantime be sure to download the FloleVac app to control the vacuum. It is 1000 times better than using the Xiaomi app. https://xiaomi.flole.de

      Like

  2. Thank you for a great write up. Can I upgrade to the latest version of Mi Home app after getting the token with the old version 5.0.0? Also, can I change back to US server after that?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s