“Alexa, ask Roborock to clean my bedroom”9 min read
I mentioned in one of my previous blog posts that Home Assistant allows us to improve our smart devices. I even gave you an example of my Xiaomi Roborock S5 vacuum cleaner. If you own one of these devices, you know that until a few months ago it wasn’t possible to divide the map of your home by rooms. You could either clean the entire home or manually draw cleaning areas on the map shaped like rectangles. The worst part is that you had to do that every time because the app could not remember those zones. It looked something like this:
However, in the latest update(3.5.7_002008), they added the notion of “rooms”. Now you can tap on a room in the app and send the vacuum to clean it. In the picture below you can see how I selected 3 rooms:
I think that’s great, but let’s take it further. What if you want to ask Alexa to clean the bedroom? Can you do that using the Alexa skill for Roborock? The answer is no, at least not right now. However, it is possible using Home Assistant, and that’s what I’m going to show you in this post. However, before we do that, let’s load the map above in our Home Assistant dashboard. This will help us get the coordinates of our rooms.
Loading the Roborock map card in Home Assistant
First, you’ll need this map card from Github made by Piotr Machowski. This allows you to load the map of your home in Home Assistant and specify each room using coordinates. You can see some examples here to understand what I’m talking about. It’s very easy to install the card using the instructions from Github, so I won’t repeat them. If you have any difficulties doing this just let me know in the comments section. I’ll post a detailed article about this as well if needed.
Once you installed the map card, you should have something like this in your YAML:
As you can see in the YAML comments, I created zones for each room that I have. This allows me to control Roborock from Home Assistant like this:
You can see that I can send the vacuum to a specific location, select zones to clean up, or tap on any room and clean it. This is useful when you want to use Home Assistant instead of the official app. Now let’s get to the interesting part.
Cleaning rooms using Alexa and Home Assistant scripts
The easiest way to do this is to create a script for every room that we want to clean. Then we expose that script to Alexa using the Home Assistant integration. Once we have this in place, we just say “Alexa, turn on <name of script>” and Roborock will start cleaning the area defined by that script. Let’s do this step by step.
First, you’ll need the Alexa integration for Home Assistant. Once the setup is ready you will be able to sync everything you want from Home Assistant to Alexa. Here’s how my Alexa integration looks:
If you look at the top-left entity, you can see there’s a script called “Apartment cleanup” exposed to Alexa. The script looks like this:
This one is easy, I use the service “vacuum.start” to start my Roborock and it will clean up my house. But what if we want to clean a room instead? In this case, things are a little different because we need to give the coordinates for the room. Here’s how the script for the bedroom looks like:
If you look in the YAML file I shared above, you can see that these my bedroom coordinates. Another change is that instead of calling the service “vacuum.start” I called “xiami_miio.vacuum_clean_zone” with the required data. You can also combine areas if you need, like cleaning all the bedrooms with one command for example. I actually had to do this for my hallway which is L shaped so I used two areas, like this:
It’s pretty easy, right? You just give another set of coordinates and that’s it.
Once you finished your scripts, it’s time to expose them to Alexa. For this, you’ll have to go to your Alexa integration and make sure the scripts are toggled on. After that, press on “SYNC ENTITIES”.
Once you did this, Alexa should immediately notify you that it found new scenes. Here’s how the notifications look on my Android:
This is it! You can do exactly what the notification says. Just give the command “Alexa, turn on hallway cleanup” and Roborock will go in the hallway and start cleaning it.
Other ways to do this – Alexa routines
The problem with this method is that you’re forced to say this exact phrase “Alexa, turn on..” followed by the script name. But you may want to do something different, like saying “Alexa, clean under the kitchen table”, and doing just that. You can achieve this by using routines, and it’s very easy.
First, open the Alexa app and go to your routines, then start a new one and give it a name. After that under “WHEN YOU SAY” you can specify what phrase invokes this routine. In my case, I was creating the hallway clean up so I used “ask Roborock to clean the hallway”.
Now we have to add an action, and here is where we’re going to tell Alexa to invoke our script. Tap on the plus icon and choose “Control scene”.
Here you’ll find a list of scripts exposed by Home Assistant. You just have to pick the one you want, I named my script “Clean the hallway”. I also added another step where Alexa will confirm my command by saying “Ok, cleaning the hallway”. Here’s how the final routine looks like:
This method is a bit longer, with a few more steps, and you’ll have to do it for every room. However, you can say whatever you want to invoke it, and you can add more actions in the same routine.
Another way of doing this which gives you even more flexibility is to create your custom Alexa skill. I want to be able to say “Alexa, clean the bedroom and the kitchen” and extract the rooms from this sentence. My custom skill will handle this, and then it will invoke the scripts from Home Assistant so Roborock can start cleaning. The cool part is that we won’t need the Alexa integration for Home Assistant. Instead, we can use webhooks to invoke the scripts, but I’ll show this in another article.
My goal here was to show you that Home Assistant can enhance your devices by allowing you to customize them to fit your needs. That’s one of the most important features of Home Assistant, in my opinion, the fact that you can take a device with generic features that are designed for millions of users, and make it do specific things that are useful only to you. Let me know if you tried this and encountered any difficulties, I’ll be happy to help!