N00b needs help with miiocli

Ok, so I got an Roborock S5 Max which I added to HA (yes got past the token extraction, added it through configuration.yaml and it work beautifully). I want to retrieve the room numbers.

It says that you can use the miio command-line tool for that and it is giving a clear example on how to use it:

miiocli vacuum --ip <ip of the vacuum> --token <your vacuum token> get_room_mapping

I’m running Home Assistant OS 5.12 on a raspberry pi, so I installed the add-on: Terminal & SSH

I use Putty to connect to my HA and try to run the miiocli command. But it says it cannot find the command:

-bash: miiocli: command not found

I am under the impression that the Xiaomi Miio platform is intergrated in HA, since I can simply reference to that platform by stating it in my configuration.yaml. Therefore I expect I should be able to use the miiocli command as wel, since it is referenced by the Xiomi Mio documentation.

I know I’m missing something huge here, because I can’t find any info on people not being able to use the command. Can someone please tell me what an idiot I am for missing something so obvious :slight_smile:

1 Like

So I’m still intrested to know in what I’m doing wrong! However I found a workaround to fetch the room numbers. I used Node Red for this. I added miio roborock to Node Red. This allowed me to fetch the room mappings.

If I had read the Xiaomi Miio - retrieving room numbers better, than I would find out that I could use number 16 and up foor room id’s.
1-15 are reserved, your own mapped rooms start @ 16. So just give the command to clean room “16” and observe which room your robot is going to clean. Then room 17 etc. Would have saved me a lot of time.

As I said, in the intrest of learning I would still like to know how to use the miiocli command :slight_smile:

3 Likes

Hi Dujinga,

I feel your pain, same struggle out here!

Same as you I walked my way around to get the room numbers, but I still have this small frustration in me because I wasn’t able to use the miiocli and I’m pretty sure that it can’t be that hard to use it.

Reading your post I think I got a step further than you. This miiocli tool is available on git at this link and has to be installed, you will not have it by default. But I’m having an error when I try to install it. I have no experience at all with python, but from what I found on google I think the command to install it is the following:

python -m pip install -e git+https://github.com/rytilahti/python-miio.git#egg=python-miio

But as I said before, I had no success with it…

I want to believe that many other people have struggled and will struggle with this, so it would be nice to have an answer for this.

First of all was my post helpfull to at least figure out the room numbers, if not let me know where you get stuck so maybe I can help.

From which platform are you trying to run the command? If you are on a raspberry pi I think these commands will not work. The raspberry is a slimed down Linux kernel as far as I know.

Well, I didn’t really used the information you shared to find the room numbers because I was able to get them by myself calling the command “app_segment_clean” using the numbers from 16 onwards. But I didn’t knew that method with node red witch was nice to know.

I was trying to run the miiocli directly on a linux server where I have my HA running.

I got a response on Discord. You will need to install miiocli in Python on a separate machine. I.e. it cannot be installed on Home Assistant OS. I agree it is unclear, I will propose a change to the docs mentioning this information.

2 Likes

Thank you for your effort!

Hi yuz, I installed miiocli on a seperate pi. Seems to be running in that the info command returns:

Model: roborock.vacuum.s5e
Hardware version: Linux
Firmware version: 3.5.8_1482

However the get_room_mapping command just returns:

Running command get_room_mapping
[]

Not sure if this is useful or not.

Finally got this working, But typical with these sorts of things when you’re trying a million things at once to troubleshoot, it’s hard to pin down what exactly fixed it. I got it working on a windows machine with npm and nodejs installed. Then did this:

pip3 install python-miio

and then:

miiocli vacuum --ip 192.yours.here --token yourshere get_room_mapping

For me that returns:

[[16, ‘9001061271’], [17, ‘9001061279’], [19, ‘9001061272’], [20, ‘9001061273’], [25, ‘9001061276’], [26, ‘9001061274’], [28, ‘9001061275’], [29, ‘9001061277’], [30, ‘9001061278’]]

So helpful in that I can see what room IDs were skipped, but I still have to send the vacuum to those segments to work out what they are. So if you can’t get this working, take heart that it’s not saving a heap of time anyhow.

I’m on the same boat here.
Let me recap.
Hassio on RPi4. The various commands mentioned above would not work on Terminal & SSH.
Since I’m on a Windows machine, I installed Python first from

choosing Windows installer (64-bit)
Then I opened up a command prompt.

python -m pip install -e git+https://github.com/rytilahti/python-miio.git#egg=python-miio
python.exe -m pip install --upgrade pip

and
yarn add https://github.com/rytilahti/python-miio.git
in the end if I recall because the other commands would not complete

Then
pip3 install python-miio
failed asking for Microsoft Visual C++ 14
I went to Outils de génération Microsoft C++ - Visual Studio as suggested and installed this huge piece of software :expressionless:

Rebooted my PC then tried pip3 install python-miio again and succeeded.
miiocli vacuum --ip <ip of the vacuum> --token <your vacuum token> get_room_mapping
worked but returned

C:\Users\jerom\AppData\Local\Programs\Python\Python310\lib\site-packages\miio\click_common.py:270: DeprecationWarning: Call to deprecated function __init__ (This class will become the base class for all vacuum implementations. Use RoborockVacuum to control roborock vacuums.).
  ctx.obj = self.device_class(*args, **kwargs)
Running command get_room_mapping
[]

I might have to run a full floor cleanup to let Roborock recalculate the rooms :man_shrugging:

1 Like

If you haven’t done so, that’s definitely a must for the vacuum to recognize the rooms and allow you to name and adjust it, BEFORE you try to get the room IDs

You need to name the rooms in the app, once I did that the cli worked

How to get room numbers using node red and miio-roborock? I filled in the xiaomi cloud data, but after clicking the deploy button, nothing happens. I am new to node red.

As far as I can tell, these methods do not work with the S5, so I did it the manual way.

Open the app so the map is showing. Then use HA’s Developer Tools to call vacuum.send_command (as per here). Start with segment 16 and continue experimenting with numbers after that. You don’t have to wait for the vacuum to get to the room, the app will show you which room it’s going to clean. Then just stop it and try the next number.

I have 4 rooms - the first 3 were 16-18, and I gave up finding the 4th once I got to 23. Instead I merged two rooms and then split them again, while crossing my fingers. Voila, this left the old one at 18, and made the previously unknown one 19.

1 Like

looking to the map, you would know which room was missing. I would try to split and merge, and hope to renumber that room as 19. not messing with 18 but still with fingers crossed :slight_smile:

suggestion is because I’ve also a S5 and so - no roborock app and no map , neither room names being extrated