Xiaomi vacuum restore/select backup map (multi floor support)

I need a feature where I can switch the current map in my Roborock S6 to be able to put him in another floor in my house and start cleaning of selected rooms on that floor. All controlled by Home Assistant (except moving him physically to the other floor :grinning:).

Current functions of the Xiaomi integration let me start and stop a cleaning of selected rooms with
xiaomi_miio.vacuum_clean_segment
But if I start this service on floor A, but map from floor B is the current loaded map, the cleaning fails. The vacuum does not automatically load the correct map.

My Roborock S6 (Xiaomi) supports backup maps which can be used for multi floors in the house. It is possible to select the maps through the Xiaomi app. If I select the right map through the app first, room cleaning works as expected.

Target would be to have a service like xiaomi_miio.vacuum_restore_map which I can call before the segment cleaning service.

The MIIO tooling seems to already support this command:
https://github.com/rytilahti/python-miio/blob/cb15f5dc3517cdbf18f8217cc3424c04414ab8d8/miio/vacuum.py
With https://github.com/rytilahti/python-miio/blob/cb15f5dc3517cdbf18f8217cc3424c04414ab8d8/miio/vacuum.py#L698 it seems to be possible to also get the map IDs.

Do not forget to vote!

There is an old feature request for this with a different use case:

Hi, I’ve open a PR for this:

Unluckily I was hoping to benefit directly from this, having a Roborock Max 5, but unluckily this does not work on my model:

(xiaomi) 15:54:41 (/tmp/xiaomi)$ bin/miiocli vacuum --ip 192.168.5.116    --token XXX get_backup_maps
Running command get_backup_maps
unknown_method

Thank you so much for your effort. Because of that I worked hard on installing miiocli. I finally got it to work.
Nevertheless, you are right. I tried both commands get_backup_maps and use_backup_map. Both return unknown_method.
I have a Roborock S6 and changing maps with the Android app works fine. Anything else I can try?

UPDATE:
I found a new set of commands in the OpenHab forum:
https://community.openhab.org/t/cleaning-specific-room-and-zones-with-multi-level-map-roborock/115329/11?u=enjoysimpson

The command get_multi_maps_list works and returns:
[{'max_multi_map': 4, 'max_bak_map': 0, 'multi_map_count': 2, 'map_info': [{'mapFlag': 0, 'add_time': 1610144299, 'length': 11, 'name': 'Erdgeschoss', 'bak_maps': []}, {'mapFlag': 1, 'add_time': 1613669204, 'length': 12, 'name': 'Obergeschoss', 'bak_maps': []}]}]
Very interesting and exactly the map description I see in the Android App from Xiaomi.

With the help of different command lists, I found a new command through try and error, which might help to recover a dedicated map of a floor/level:
recover_multi_map []
It seems to be a valid method, but I could not figure out which parameters I have to provide. I called the commands with the mirobo tool in a Debian console ( mirobo --ip 192.168.x.x --token xxxxx raw-command recover_multi_map ). Responses of command:
recover_multi_map -> Error: No response from device
recover_multi_map 1 -> Error: {'code': -10005, 'message': 'Params is not an Array'}
recover_multi_map [1] -> Error: {'code': -10005, 'message': 'First element in array is not an object'}

Any idea, what parameters I could try? It looks, we are close :slight_smile:

Hi, I just tested a method which works on my Roborock S5 Max.

Based on XiaomiRobotVacuumProtocol/multimap.md at 953d026f4f77cb060a6e82acab8bd485a09e13d1 · marcelrv/XiaomiRobotVacuumProtocol · GitHub

The methods load_multi_map [1] and load_multi_map [0] work for me.

Can you try it ?

In my HA Service I do

Good Luck

8 Likes

Great, this works! Thank you very much for posting! :+1:

You’re welcome !
Thank for your previous OpenHab research, it helped me a lot !

Wow, I’ve noticed this just now!

It works, thank you very much!

Just as a reference, my maps on S5 Max are on indexes 0 and 2

It works like a charm!
Thank you, dude!

I’ve got roborock connected to HA, but when I search for commands I can’t find the load_multi_map command? Do I need something more than the xiaomi integration?

The action type is Call Service and service is vacuum.send.command.
In the command section you can use (in my e.g.) app_segment_clean or this load_multi_map command.
Parameters are also important: 0-4

1 Like

Ahh!
Thought the service was load_multi_map!
Thanks! That worked like a charm :slight_smile:

1 Like

Oh wow - thanks everyone! I thought this functionality didn’t exist and it was beginning to frustrate me!
Cheers!

I’ve successfully configured switching maps on the vacuum using the load_multi_map command. BUT, is there a way to find out which map is currently restored on the vacuum, i.e. the active map index?

@Strachon : Interresting question. The problem is that a service call doesn’t return any response to Home Assistant.

You’ve at least 2 ways to do it :

  1. find the method to deduce it and run a separate script to update an home assistant entity. I didn’t find this method for now.

2 (recommended). You could use this HACS integration.

It creates a “camera” entity in your home assistant server.
This camera has attributes you can see in developper tools

When you vacuum changes map, it will give you differents values as you can see :

image

The only thing you have to do is to watch the value of
{{ state_attr(“camera.roborock_s5_max_map”, “calibration_points”)[0][“map”][“x”] }} (in my case, it switches from 344 to 240)
or
{{ state_attr(“camera.roborock_s5_max_map”, “calibration_points”)[0][“map”][“y”] }}

to trigger an automation based on a template trigger like so :

you named her “Rosie”. Love it!