Connecting Xiaomi Roborock S6

This is for anyone trying to connect the Xiaomi Roborock S6 to Home Assistant.

I am trying to get the RoboRock S6 connected to Home Assistant. Connecting using the Xiami Home went fine. I did not choose China according to the instructions here, but The Netherlands.

https://www.home-assistant.io/integrations/vacuum.xiaomi_miio/#retrieving-the-access-token

First I tried the Android App solution, but my version was different (5.6.60) and I did not have a /Smarthome folder and no other folder that looked like the right one. I did not try downloading another version through Aptoide, but thought the miio option looked easier.

First I needed a Linux host that understood the npm command. Iā€™m using Docker on Synology but the Linux that comes with the Home Assistant container does not know npm. Also the marthoc/deconz or eclipse-mosquitto containers did not. Luckily my Synology knows now to npm, so I used that.

First:

sudo npm install -g miio

That gave some warnings but it looked okay. Then the command

miio discover

That gave error command not found.
After looking on the system I found that I could use

cd /node_modules/miio/cli
./index.js discover

I donā€™t know what I did wrong, but at least it gave me some Rockrock data.

Device ID: 321283121
Model info: Unknown
Address: 192.168.2.212
Token: ???
Support: Unknown

I think I need to delete the Roborock from the app and try againā€¦

1 Like

With Android, you need version 5.4.54 of the app, to see the token in log file.
You have to googl a bit to find that version, since it is removed many places from the net because of that ā€œbugā€ in the Mi Home of that version. Token is essential to connect with the Roborock.

I just deleted the Roborock from the App and reset the machine. Now it broadcasts a private network ā€˜roborock-vacuum-s6_miap6014ā€™. When I connect to it using my phone, I get ip-address 192.168.8.159. My normal subnet is 192.168.2.0/24, so I canā€™t connect to it from my PC (I donā€™t have a WLAN adapter) but also not from my Synology Diskstation where I have the miio tool. :thinking:

I have a few options to connect to the Roborock:

  1. from my Windows laptop, where I donā€™t have the miio tool, or a linux virtual machine. I could install VMWare Workstation and download some distribution that supports npm and use that on the laptop.
  2. by changing my subnet from 192.168.2.0/24 to 192.168.0.0/16 (subnet 255.255.0.0) or to 192.168.8.0/24. That would mean a whole lot of configuration. I should do that sometimes at night, because in the daytime I would still like to be able to use my Home Assistant.
  3. By adding an extra wifi subnet to my router (experia v10) or the PowerLine adapters (Devolo dLan). But I donā€™t know if itā€™s possible to add a second wlan.
  4. Getting a wlan adapter and connecting it to the synology. It should be possible to use it as a second network adapter, but Iā€™ve never tried this on Linux as Iā€™m a Windows guy.
  5. I tried to connect from my phone to the default gateway, 192.168.2.1, but my connection is rejected. I hoped to be able to change the IP-address of the Roborock.
  6. Maybe itā€™s possible to install router software on my phone, so I can connect from my normal network to the Roborock.

Iā€™ll sleep on it, but for now reconnect the Roborock to the App again, so I can clean the house tomorrow ! :smiley:

Thanks. I was busy on the miio-road that I forgot the possibility to install another version of the software. Iā€™l install aptoide and look for 5.4.54. Or on newsgroups. Should not be hard to find.

After you have started the app one time (and logged in), just exit the app.
Find the log with new timestamp in the folder /sdcard/SmartHome/logs/Plug_Devicemanager/
Open the log (text file). and search for the word token: and it should be 32-characters long.

I looked for version 5.4.54 on these websites:

So, youā€™re saying I donā€™t need to connect the Roborock using the app, just get the api key?

By the way, when I set my location to China, I can only add an Xiaomi Viomi but I canā€™t find of connect the Roborock S6. When set to Europe I can select to add it, but now the app cannot find the robot. Just presses the reset button (right to the wifi led) and kept spot and home buttons pressed. Now itā€™s factory resettingā€¦

Okay, itā€™s connected to the app.

I opened the file with Notepad but thatā€™s one blur with characters. I copied it to Notepad++ and now itā€™s a bit more readable.

I found the token, put in my configuration.yaml and restarted.

Now I have vacuum.stoffel in Home Assistant. But with status ā€˜unavailableā€™. And when I say vacuum.start to stoffel, nothing happens.

And you have added something like this in the configuration.yaml and restarted HA ?

vacuum:

  • platform: xiaomi_miio
    host: 192.168.X.X
    token: 5488808754XXXXXXXXXXX

And: Home Assistant need to have outbound internet, so do the Roborock.
DNS and default gateway correctly set, because both connect to Mi Home cloud to communicate.

Aha, I think I found the problem. I was looking for the ā€œtokenā€ string, but I did not realise that Mi Home app had also found my Yeelight lamps and I used the token of the first lamp.

So the part that I should be looking for was in a very long json variable, where only this piece was relevant:

{"did":"321283121","token":"6a3157346f7451336d5747536b4a6c78","longitude":"0.00000000","latitude":"0.00000000","name":"Roborock S6","pid":"0","localip":"192.168.2.212","mac":"64:90:C1:10:60:14", ...

Note the token string, and a few entries later ā€œRoborock S6ā€. Thatā€™s the one.

Everything is working fine now. I added the two custom cards for the Roborock. Only the map is not displaying, but I can start and stop stoffel from within Home Assistant.

Thanks, Smurfen, for your support and putting me back on the right track when I wanted to stray from it (the miio path).

1 Like

ThatĀ“s good to hear that you got it to work, just a pleasure to help each other here.

To get live map, you have to root the Roborock, mine is from january so because of warranty i do not want to do that.
But i have a map, predefined rooms, zone cleaning from HA, but you donĀ“t see the robot and it is not live. Map is based on floor plan drawing, and calibrated by using coordinates and XY pixels. Look here:

I am using that card, and in addition a card from here:

1 Like

Thanks, I will do that.

I tried a number of options to get the right coordinates, The Flolevac app returned a jibberish map that was no use. Finally I just measured my room and calculated coordinates based on 1 point is 1 mm and the center is [25600, 25600]. What did not help was that the lovelace-xiaomi-vacuum-map-card remembered the old data, even after clearing the cache and rebooting my computer. If I updated the map.png I kept getting the first one I made, so I ended up with map6.png.

Maybe itā€™s me, because with the Xiaomi Vacuum cleaner Card I renamed the

automation.takarĆ­tas_utemezese_hetvegen

to

automation.cleaning_timer_weekend

but only the first name kept showing up.

Anyways, hereā€™s what I did to get the coordinates, with a screenshot of the Xiami Home map.

From Developer Tools, Services, choose service vacuum.send_command and give these parameters:

  entity_id: vacuum.stoffel
  command: app_goto_target
  params: [24600, 24600]

This helps with finding the right coordinates on the map.

I ended up with this in my configuration:

- calibration_points:
      x: 20900
      y: 19500
    map:
      x: 37
      y: 37
  - vacuum:
      x: 26300
      y: 19500
    map:
      x: 37
      y: 1275
  - vacuum:
      x: 26300
      y: 29500
    map:
      x: 2361
      y: 1275

One funny thing I noticed is that when the Roborock encounters a mirror (or a shiny vase on the floor) it thinks that there is something behind the mirror. Next time I will check if it slows down there or just crashes hard in the mirror. :slight_smile:

I used my original house floorplan drawing, and used paint.net with layers to create the map.
Then used goto to three points to get the calibration coordinates.

I have wardrobe with doors in mirror, it slows down and never bumped in to the doors :slight_smile:

Did you ever get the live cards working in HA? Did you root your S6? I have a S5 Max and i managed to get everything working in HA expect the live mapsā€¦ still trying to figure out how to do thatā€¦ any tips are helpful

I have not hacked my Roborock, so the live map does not work for me.

a simple new way for the Roborock S6 Token:

1 Like

I used token extractor tool to add to config,yaml but the vacuum state stays on unavailable. When i check the logs:
meassistant.components.vacuum] Updating xiaomi_miio vacuum took longer than the scheduled update interval 0:00:20strong text
can some please help. thanks

Can you ping the vacuum from your ha host?

I Got it

check out:

This was very smooth! :slight_smile: