[Custom Component] Roborock communication

For anyone who read this thread and still had no idea what should be done to get the Roborock token when you use the Roborock app. This post is for you. This is what I did and it worked like a charm. I used windows 10.

  1. Download and install Bluestacks 4 https://www.bluestacks.com/
  2. Open Bluestacks and install the Roborock app from the play store
  3. Login to the Roborock app and make sure the vacuum is added. (I did this on my phone months ago)
  4. You now need to “root” Bluestacks to get access to the folder you need. This can be done with BSTweaker 5. You can download it from https://bstweaker.tk/
  5. Extract BSTweaker 5 to your PC. Open BlueStacksTweaker5.exe.
  6. In the “Main” tab click on “Force Kill BS”
  7. In the “Root” tab, click “Unlock”
  8. Go back to the “Main” tab and click “Start BS”
  9. Next on the same tab click “Install SuperSU” and then “Update SuperSU” when the first is done.
  10. Start Bluestacks again and check that it is successfully rooted. You can download something like “Root checker Basic” from the play store
  11. Go back to BSTweaker 5, goto tab “FM”. The right-hand side will be your Bluestacks system and the left hand your local windows system.
  12. On the right hand nagibate to /data/data/com.roborock.smart/files/rr_cache/
  13. Look for a file called starting with “rr_tuya_” and ending in a bunch of numbers. For example. “rr_tuya_145367”
  14. Select this file by clicking on it. Select a location on the left and click “Copy”, above the right hand window on the right top.
  15. Navigate to the location you copied the file and rename the “rr_tuya_???” to “rr_tuya_???.zip”
  16. Now unzip the file inside and open it.
  17. Inside this file look for “localKey”, this will be your token.
  18. Next look for “devId”, this will be your Device ID.
  19. Inside Home Assistant go to integrations and add Roborock.
  20. Enter the Name, IP, and the newly discovered Token and Device ID.

That is it you are done.

3 Likes

And this works with the native Xiaomi Vacuum component? Or does this require the custom component in this thread?

This is simply an alternative way of getting the localKey and devId. The custom component is still needed.

I understand. Thank you for clarifying.

To clarity even more; the custom component is not needed for e.g. the s5 max, because it does have tuya software, right?
I hope to confirm this using your steps later today, @JohanPotgieter
Thanks so far!

It uses the standard Tuya protocol. However, it is the standard Xiamoi Mi commands that are sent, they are just encrypted first and sent over.

This custom component bridges the gap and allows to use the latest Roborock app, alongside home assistant for the vacuum

2 Likes

Yes. I was perfectly able to retrieve the tokens, thank you. Next issue is the missing npm on my HA.
I’m running docker on an ubuntu server with hassio, any tips to get it working @bernhard ? I’m fairly new to this no hassio setup

For reference, I’ve installed the custom component by adding a custom repo and getting the Roborock integration from this repo in HACS

Hi,

you need to create a new docker image.
you take the official HA image as a base and add npm to it like in this post: [Custom Component] Roborock communication

create an empty directory somewhere on your server, add a file called “Dockerfile” and put the content in.

1 Like

Yeah thanks, that’s the info I needed.
For this route, I need to find out how and what services to expose. Which I fine, but I’m thinking about w workaround; issue container command pkg add on the running HA container.

Can confirm my HA now sees my s5 max vacuum, using latest firmware

You have to do that then on every container restart.

Yes I’m currently writing a script on host boot.
This is a workaround of course, I am hoping Roborock will get it’s own addon (I do use hassio)

For reference, the script for installing npm into hassio docker container is
docker exec -it $(docker ps -q --filter "name=homeassistant") apk add update nodejs npm

update:
So, the scripts need to be ran only once after HA has started. As a slightly better workaround, I’ve implemented the following Nodered flow based solution:

It uses docker-container-actions and the HomeAssistant nodes, and basically checks if nodejs is installed in the container and, if not, installs it (using Docker Container Execute APK commands) and restarts Home Assistant.
This can be my semi-stable workaround until easier and better support is made

2 Likes

Would it be possible for you to post the flow so that I can import it into my NodeRed? Not that familiar with it yet :smiley:

So, having grabbed the API key and device ID thanks to JohanPotgeiter’s guide, I’m now stuck with missing npm and nodejs. As I’m using HassOS, is there currently a way of installing those?

On the box, run: -

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install nodejs

Thanks, but there’s no no sudo or apt in the HassOS shell. I don’t even think it’s based on Debian any more.

Hi, I followed your instructions to the letter, but when unzipping I’m left with a empty file, only containing two brackets “[ ]” when opened i notepad++
Am i missing something? Does it matter what kind of zip tool I use?

Bluestacks version: 4.240.20.1016
BlueStacks Tweaker 5.16.1
Roborock app version: 2.3.8

Did you add the Robot to the app on Bluestacks or did you login to find the device there? You have to see the device in bluestacks. If you see the device in the app then I would send the vacuum to do something. The point is that the app needs to write the file. Currently your file is empty.

Good luck.

Not sure how to add it to the Xiaomi Miio app. I was able to follow all the instructions, but my Token (LocalKey) is only 17 characters, not 32.

This is only for the Roborock app, not the Xiaomi Home app.

Sadly having the same issue here with HassIO supervised installed on top of ubuntu server. NPM is there but homeassistant cannot escape the docker container ;).
Yet I wanted to share something I found out. If you go with bluestacks there is no need to do the rooting procedure. There is a su available in:

system/xbin/bstk/su

Then you can copy the files by hand.

1 Like