Roborock & home assistant
I'm using Roborock for quite some time now, however, recently I faced some challenges with it - the map for the robot vacuum was not loading in home assistant and it turned out to be not loading even in Xiaomi app. After some digging I found the solutions thanks to other enthusiasts which I will describe later to complete your setup.
First things first.
You can't use Roborock app in combination with home assistant as there is no integration available for that. Instead you will need to remove Roborock app and use Xiaomi Home app and add your vacuum there.
Once your vacuum is in the Xiaomi Home app, proceed with integrating Xiaomi in your home assistant via Xiaomi Miio integration. It is a cloud based integration, make sure it is not blocked by your firewall or other means.
So far so good.
If you look into the device, you will see everything related to your vacuum - sensor data, statistics, latest updates from the device and you can see some of the automations and scripts related to the device.
I like the fact that you can select specific room to clean, therefore I'll spend a word on that. You will need to define your rooms in Xiaomi Home app. Later on you will need to map these rooms in your home assistant manually. One caveat is the following - I would advise you to save your vacuum map on Xiaomi Home app and restore it in the app every time there's something wrong where wrongs being:
- someone decides to move robot by hand
- robot gets stuck and is moved manually
- software glitch
How do you actually send the roborock to a specific room via home assistant? You need to run a service command indicating the room id.
The command in home assistant:
Xiaomi Miio: Vacuum clean segment
and indicate the room id
Now, the not so fun part - how can one find a room number? I had to do a trial and error exercise as I couldn't find a "nice" way of finding it out at the time of configuration, perhaps when you read this, it is actually possible. My advice is to start with 20 and see if your robot goes to any room.
What I did was I created a script for each room and added them to my lovelace dashboard that you can see in this sneak peak preview.
You may also want to create an additional view with a map by using lovelace card.
For that you will need two components:
1. Xiaomi Cloud Map Extractor
2. Lovelace Xiaomi Vacuum Map Card
Both can be installed via HACS.
Last but not least - the issue with updating the map - is related to the number of API calls that home assistant is generating by the integration. It quickly hits the API rate limit and even your app on the phone is unable to retrieve the map.
One way is to decrease the scan interval for the integration, however, I'm not sure why would you actually need to retrieve the map while your robot is on standby.
Therefore I would suggest to use an automation that disabled periodic map retrieval while your roborock is docked. The easiest is to use a blueprint that allows you to simply select your robot and create the automation for you.