Xiaomi roborock room clean (multi level map)

great.

I have still the problem with different maps for differnt floors.

I have an s5 and a s6 maxv so i dont need to mix maps.

Wondering if you have ever figured out how to change floor maps in OH?

Unfortunately I did not find out. I would be happy if there was a solution.

Hi Georg,

I have a work around that I’ve been using. I have an S4Max, not sure if other robots can do this or not but here is what I do:

  • I created two maps, one for each floor of my house.
  • When I move my robot form one floor to the next, I put it on the floor (not the dock) and hit the dock button. It attempts to return to the dock. Usually it says “invalid map” and returns to the dock. Next I hit the clean button, it comes off of the dock and says “positioning”. It will drive a round for a minute but eventually it figured out which map is the correct one for the floor it is on and says “position established”. I then hit the home button again and it goes to the dock knowing what floor it is on.

Using the get_floor_mappings command I was able to determine the rooms and their IDs for each floor.
You can see each room number has a distinct ID even when the number is repeated between floors:

//Second Floor Map
//{"id":8830,"result":[[16,"536001005515"],[17,"536001005513"],[18,"536001005511"],[20,"536001005519"],[21,"536001005517"]],"exe_time":100}

//First Floor Map
//{"id":12270,"result":[[16,"536001005545"],[17,"536001005547"],[18,"536001005549"]],"exe_time":100}

I have a set of rules to determine what floor it is on. The Test Rooms rule is run actually by another rule anytime the statue changed to charging - which happens whenever the vac returns to the dock.

rule "Test Roborock Rooms"
	when
		Item testroborooms received command
	then
		logInfo("test robo rooms", "!!!!!!!!!!!!!!!!!!!!!! testing rooms")
		actionCommand.sendCommand("get_room_mapping")
	end

rule "What Floor"
	when
		Item actionCommand received update
	then
		//When a floor map is received parse it and set to the approproate floor or warn of unknown floor
		//2nd floor - actionCommand changed to {"id":8830,"result":[[16,"536001005515"],[17,"536001005513"],[18,"536001005511"],[20,"536001005519"],[21,"536001005517"]],"exe_time":100}
		//1st floor - actionCommand changed to {"id":3010,"result":[[16,"536001005545"],[17,"536001005547"],[18,"536001005549"]]
		logInfo("Clean Room", "!!!!!!!!!!!!!!!!!!!!!! Floor Check")
		val firstRoomNumber = transform("JSONPATH", "$.result[0][0]", actionCommand.state.toString)
		if (firstRoomNumber == "16"){
			logInfo("Clean Room", "!!!!!!!!!!!!!!!!!!!!!! First Room = 16")
			val room16ID = transform("JSONPATH", "$.result[0][1]", actionCommand.state.toString)
			if (room16ID == "536001005515") {
				mapFloor.sendCommand(2)
				logInfo("Clean Room", "!!!!!!!!!!!!!!!!!!!!!! First Room ID = 536001005515 - We're on the 2nd floor")
			} else if (room16ID == "536001005545") {
				mapFloor.sendCommand(1)
				logInfo("Clean Room", "!!!!!!!!!!!!!!!!!!!!!! First Room ID = 536001005545 - We're on the 1st floor")
			} else {
				logInfo("Clean Room", "!!!!!!!!!!!!!!!!!!!!!! First Room ID = " + room16ID + " There is no floor with room 16 that matches this room ID.  Look s liek you've changed your mapping")
			}
		}
	end

So - essentially I let the vacuum determine for itself what floro it is on and load the correct map on its own. I then determine what floor it is on by parsing the room mapping IDs. This isn’t really needed, but I use it to set visibilities on my site map for things that are floor specific:

For example, I have single room cleaning set up for each room, and only have the correct set of rooms displayed for the floor the vac is on. I also have a spot cleaning set up that is only on the first floor. Also, I have a go to point set up for the var to meet me by the garbage on the first floor so I can easily empty the dust bin. So I only show that on my sitemap when the vac is on the first floor:

            Selection item=cleanRoom	mappings=[0="Select Room to Clean", 18="Bub Room", 20="Computer Room", 21="Hallway", 16="Master Bedroom", 17="Upstairs Bathroom"]	visibility=[mapFloor==2]
			Selection item=cleanRoom	mappings=[0="Select Room to Clean", 16="Kitchen", 17="Dining Room", 18="Living Room"]	visibility=[mapFloor==1]
			Switch item=cleanLVCarpet	mappings=[ON="Clean"]	visibility=[mapFloor==1]
			Switch item=meetbyTrash 	mappings=[ON="Go"]	visibility=[mapFloor==1]
2 Likes

Hi Tom,
sorry for the late response and thank you very much for this solution. I think this will work for me. I will test it.

1 Like

BTW, I found that it is also possible to see when the robot is “positioning” and "Position established. I put in an issue and in like 1 day the binding author added this as a channel. Looks like it will be included in OH3.1 release (Unfortunately for me as I’m running 2.5.x for some time still) but this will make it possible to make a better rule in terms of when to parse your room map for what floor it is on. In my example I did above I waited unit it returned to the dock, but parsing the room map after position established will be better.

Thank you for the information. I’m thinking about testing version 3 soon. But a lot to do at the moment.

Hi,

thank you for the proposal of the enhancement. This is great.

BR
PeterK

Hi,

Perhaps we should combine the rules. I used the approach mentioned here in order to control room and also zone cleaning with multiple maps…

I will test “version 2 (including zones)” in the next 1-2 days.
BR PeterK

I guess I’m not really sure what the difference in these two approaches is. At the core of both is checking the room mapping for a known room ID to determine which floor map the robot is using. Can you summarize the difference in these two?

Hi,

precisely… the “find the current floor”- part is taken from this thread (linked here). I just made it easier to configure using a map-file for the room16ID and I don’t need access to the robot (hitting the button). Mostly the robot will start from the dock.

The complete set of my rules is around this part.
You have a switch “clean kitchen”. If you use this, the rule will

  • check on which floor the robot is (using this approach here)
    but then also
  • check on which floor the “to be cleaned” room is
  • get the correct ID of the room from a map-file and send the robot to this room

Next version will also be able to clean a specific zone defined in a map-file.

I did not use this “find the current floor” 1:1 as does not fit perfectly. I now think this might be a bad Idea on the long run. You are still working to improve the rule (and even the binding) and I will have to always integrate my changes.

I would be happy to just combine the rules for “finding the floor” and then use your rule 1:1 just concentrating on the “surroundings”.

BR
PeterK

Hi,

this might be interesting for you too. It is a different approach, but still using your basic Idea :wink:

BR
Peter

Hi, I am just bought a Roborock S6 Pure and now hanging on this issue to get the room IDs from the device.

With the get_room_mapping command I always get an empty “[]” as return.

mirobo raw-command get_room_mapping []
Sending cmd get_room_mapping with params []
[]

But for example the get_multi_maps_list command is delivering me a list of the three used stories of my home.

mirobo raw-command get_multi_maps_list []
Sending cmd get_multi_maps_list with params []
[{'max_multi_map': 4, 'max_bak_map': 0, 'multi_map_count': 3, 'map_info': [{'mapFlag': 0, 'add_time': 1616845175, 'length': 2, 'name': 'EG', 'bak_maps': []}, {'mapFlag': 1, 'add_time': 1616658633, 'length': 2, 'name': 'DG', 'bak_maps': []}, {'mapFlag': 2, 'add_time': 1616697950, 'length': 2, 'name': 'OG', 'bak_maps': []}]}]

How can I get the room IDs?

You don’t need the map for the room IDs. The rooms start with id 16 and go untill 31 or something like that. I have 16,17,18,19,20. To find out which room is the number I tested it.

I’ve tested it. #16 and #17 was a room which I did divided manually within the Mi Home app.

All other IDs 18-31 did not matched to a room although I do have in the ground floor 5 rooms in the app.

Any ideas?

Dear moonraker,
i think the not all room numbers have to start at 16. In my configuration i have a mix of numbers smaller than 16 and greater/equal 16. it looks like that:

2021-05-01 12:33:31.125 [DEBUG] [inding.miio.internal.robot.RRMapDraw] - Identified rooms in map: 16 17 2 18 19 20 4 21

I assume this depends on whether the app automatically identified and cutted the room or was done manually by you. Anyhow with this information, you know whcih rooms RoboRock knows. To identify which room in your map they belong, just start vacuuming and the map on the mobile shows you the active room.
Regards

That is the only way I know:

Hi all, i’m an openhab beginner, i recently configured my roborock.vacuum.m1s to work with openhab 3 installed on my rpi4. Now i’m trying to detect the rooms number in order to specifically clean them. Where do i have to send the get_floor_mappings command and where can i see the result? What is the right syntax?

I just dealt with this just now.
It’s easier if you send the following command: app_segment_clean[16]
See which room it’s going to clean in the app.
And keep going up from there. 17 18 19… I mapped all my rooms just now like this.
Now my neighbours hate me but oh well, priorities.

Aditional useful commands I also found:
app_goto_target [25500,25500] → Send vaccum back to the dock or, conversely → app_goto_target [28500,25500] → Sends vaccum to a place next to the dock.
You open the “pin and go” function in the app and see where it went.

I’m using node red to send these commands.

@PeterK sorry to bug you, but I was wondering something. When I take out the bin from my roborock it complains about it and I hear a “ding”. Is by any chance this information updated or stored somewhere?
I would like to, for example, check when was it the last time that the deposit was cleaned, and 48 hours after, send the robot to the dustbin for cleaning.

Is this possible in the way I’m thinking, or do you have another inteligent solution that I might be missing right now?

Cheers!

1 Like