[Custom Component] Roborock communication

Hey @redphx really appreciate your work on this, same goes for @jd89.

I got a S6 MaxV as well, and tried to get it working.

You can get the local key from the current app as well as the device ID with # zcat /data/data/com.roborock.smart/files/rr_cache/rr*.

One or the files - I think it’s rr_rr* - contains some JSON which holds a field called:

"duid":"XOels3vw1aL8ozVwspMxu" (my code just slightly modified)

And a local key in a field called:

"localKey":"EMERrf7jiXu3RkjQ" (my code just slightly modified)

Any idea if that’s the right info?

Yes, thats correct. Didn’t work with me. I think the reason is that my account is’t migrated to Tuya. You find this info also in that file.

A bit strange, I thought the communication of the App is running locally to the roborock.

I remember that there was some kind of server issue like a month ago and I couldn’t load the map. But starting stopping etc worked fine without any delay.

Does it work with your device? Mine in HA stays unavailable.

Only when using the Xiaomi Home App to connect the Roborock to the Wi-Fi.

Sure you’ll loose the live camera streaming, but everything else is unaffected.

I have in log:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/roborock/vacuum.py", line 138, in async_setup_entry
    vacuum = Roborock(ip=host, device_id=device_id, token=token)
  File "/usr/local/lib/python3.8/site-packages/pyroborock/__init__.py", line 147, in __init__
    super().__init__(ip, token, debug=debug)
  File "/usr/local/lib/python3.8/site-packages/miio/vacuum.py", line 108, in __init__
    super().__init__(ip, token, start_id, debug)
  File "/usr/local/lib/python3.8/site-packages/miio/device.py", line 151, in __init__
    self._protocol = MiIOProtocol(
  File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 43, in __init__
    self.token = bytes.fromhex(token)
ValueError: non-hexadecimal number found in fromhex() arg at position 3

Local key is correct from rr_rr file

same error here now. Had it working before :confused: any luck ?

Edit: I switches to the Mii Home app and using HA niet cloud integration now :frowning:

Roborock support reply says not supported…

1 Like

I were able to find the token inside Filza on a jailbroken iOS device btw:

In the file /var/Containers/mobile/Data/Application/2E3DA69C-60A6-4C90-B981-83.../Library/Preferences/com.roborock.smart.plist

You can find the field RRIoTDeviceListCache_XXXXX containing a json-string where you can find the duid (device-id) and localKey (token).

Anyone having this integration working…
I found this in an iTunes backup of my iPhone… but no devid? which id to use?

Hello,
just found this thread regarding a tuya vulnerability a while back:

https://global.roborock.com/pages/disclosure-security-vulnerability-on-tuya-iot-cloud

In there is instructions on how to tell if you’re account is migrated to Tuya yet. I have a S6 MaxV and in my case, I’m still in the Roborock cloud instance.

This might help to determine if it’s worth trying to implement this component or not.

Instructions from the link above:

How can users check which IoT cloud they are connected to:

  • Users connected to Roborock IoT cloud are not affected by this vulnerability, and so they might not receive the update information.
  • For users connected to Roborock IoT cloud,the DID is a string prefixed with “rr_”.

Note:DID is a unique device ID assigned by the IoT cloud during the process of network pairing which may change subject to the device, the user and the IoT cloud.

  • How to check the DID: Tap the 3 dots at the top right corner of the main page on the Roborock app, tap “Customer Support” and then “Serial Number” or “Product Info”.
  • For users connected to Tuya IoT cloud,the DID is a string prefixed with “ty_”.
2 Likes

Can we conclude that S6 Max V is Not supported and S5 Max new version also no longer support…Its this end of this project ?

Is anyone still using this ?

is the S6 already running ?

I don’t think the S6 is a supported model, unless that’s changed recently…?

I have the necessary tokens (from a rooted Android w/ the latest app from the Play store similarly @JohanPotgieter did from step 12), but I have another issue…

I can’t use the plugin in the docker env, because it wants to install requirements by pip that requires gcc to build the binaries… I tried with @jd89’s version and the bit fresher nathanfiscus’s version, but both of them are affected.

Can I include gcc and python-dev packages into the docker container somehow to be able to use this plugin?

For a test you can add them by going into the container and running apk add python3-dev gcc musl-dev. Afterwars I was able to install nathanfiscus’s version. Please notice that the packages will get lost after deleting the Home Assistant container.

Unfortunatelly my token is not Hex so it fails with:

2022-06-04 19:14:32 ERROR (MainThread) [homeassistant.components.vacuum] Error while setting up roborock2 platform for vacuum

Traceback (most recent call last):

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform

await asyncio.shield(task)

File "/config/custom_components/roborock2/vacuum.py", line 138, in async_setup_entry

vacuum = Roborock(ip=host, device_id=device_id, token=token)

File "/usr/local/lib/python3.9/site-packages/pyroborock/__init__.py", line 147, in __init__

super().__init__(ip, token, debug=debug)

File "/usr/local/lib/python3.9/site-packages/miio/utils.py", line 42, in new_func1

return func1(*args, **kwargs)

File "/usr/local/lib/python3.9/site-packages/miio/integrations/vacuum/roborock/vacuum.py", line 909, in __init__

super().__init__(*args, **kwargs)

File "/usr/local/lib/python3.9/site-packages/miio/integrations/vacuum/roborock/vacuum.py", line 168, in __init__

super().__init__(ip, token, start_id, debug, model=model)

File "/usr/local/lib/python3.9/site-packages/miio/device.py", line 75, in __init__

self._protocol = MiIOProtocol(

File "/usr/local/lib/python3.9/site-packages/miio/miioprotocol.py", line 42, in __init__

self.token = bytes.fromhex(token)

ValueError: non-hexadecimal number found in fromhex() arg at position 1
1 Like

I updated the component and the library to support the latest version of home assistant.

See GitHub - jonryf/hass-roborock

Unfortunately, I struggle to connect to my new Roborock S7 MaxV - it stops when connecting to the local IP and port - tested both tinytuya and the ipc bridge. Someone who had a similar problem? Or might know if the new maxv model changed something?

Update: Tested with S5 Max, and had the same issues with connecting to the IP+port, which is really strange

I feel like this needs some serious development to work properly, the Tuya API seems to be outdated anyway, even for those who find their token.

We need to create proper support for the Roborock API.

I’ve got a brand new S7 MaxV, it uses the Roborock API and not Tuya.

When MITMing it with Charles on iOS, I found my token and it’s clearly using the Roborock API and encrypted MQTT commands.

1 Like

Sweet, a working Roborock integration has now been released!

1 Like

I have S6 MaxV, integration OK!!

Thank you very much

Let us know how it works. I have the same vacuum (as well as a Pure).
Does this mean we have all the features available when using the Mi Home app when using the Roborock app, with the addition of the camera and remote control only available via the Roborock app?