[Custom Component] Roborock communication

Hello,

Thank you for this component @jd89.

I also ran into the same issues already described above but I want to add how I got the localKey and devID.

I knew from the beginning that a rooted phone is needed. I still got my Nexus5 that runs CM15 and it does not have root but the TWRP. So, this is how it also works:

  • install and setup the Vacuum in Roborock App.
  • once everything works restart into recovery mode. In the Advanced menu there is a Terminal option.
  • run the Terminal and navigate to /data/data/com.roborock.smart/files/rr_cache/
  • copy the rr_tuya_xxxx to in /Downloads/tuya.gzip
  • make sure to chmod to 644 because default only the root can read.
  • after this you can restart the phone and attach a USB cable to copy the file to the computer and extract the information.

On my side, once I added the HACS to the HA after the Restart there was still not Roborock integration until I added the roborock: line to configuration.yaml.

I run the HA as a NUC + UIbuntu + Supervisor + etc so to add the NPM I went through the Portainer Add-on -> Containers -> homeassistant -> console and then ran, as already described:
apk add --update nodejs npm

I do not know the philosophy behind the Custom Components and Add-ons but maybe there is a way to create a whole in one Add-on for the Roborock - Custom Component. I have no idea what I am talking about.

I do have a question. This component only defines an Entity but no Device?
At least in my case:
image

Thank you.

Yes, my roborock s5 max is indeed an HA entity, there is no device.

Your recovery mode idea is pretty good too. I do wanted to point out that a rooted phone is not needed

  • thatā€™s where BlueStacks is being used for.

As per your remark about the add-on; yes, someone will be able to create an addon for this, its just that itā€™s not yet made :slight_smile:

Is there a way to have a solution for all versions of Hass? Hass.io, Hass os, standard installation, and docker?

Happy to implement it. If one of the config steps was to install node / npm would that work for docker too? I guess it would?

1 Like

Hi,

You are right, I read the ā€œBlueStackā€ and I was thinking of some Bluetooth Stack and just ignored the option.

Well I know better next time.
:blush:

1 Like

Hello,

This is a good question.
I guess that all options except for standard installation (without a supervisor) will work as all of them are having the Docker containers.

But I just have a look over the default available Add-ons and all of them look like Webthingies, like web services.

This means that the Add-on will be some sort of Portal to from HomeAssistant Custom Device to Tuyaā€™s API on the Vacuum.

Then this means that the Add-on will expose some API that the Custom Component will use.

The configuration can be on either side.

Is it needed to have some sort of a socket open (like a constant network connection) to the vacuum?

Interesting :thinking:

Thanks for this integration @jd89!

How to get the map coordinates? Would be great to use them in the HA services.

Hi,

The way I understand is that the maps are stored on the Roborock Appā€™s mother ship servers.
This integration is only addressing the local network exposed API.

Maybe if you integrate the Vacuum with the MiHome App it wil allow for the Xiaomi Integration to access the Xiaomi server side maps. Who knows?

Greetings.

Wow, this looks really promising, we are many having waiting for a way to do this! Awesome job @jd89!!

ā€œSadlyā€ (well, Iā€™m more than happy with it) I have the S6 MaxV model, and I just wanted to know if anyone has had any success with that model yet, or is it still not migrated to the Tuya protocol?

Hope they will migrate it soon otherwiseā€¦ a bit weird that the latest model isnā€™t using their latest way of doing things I recon?

Anyways, big thank you for this component, I canā€™t wait to be able to give it a spin!

I have done the Bluestacks rr_tuya_xxxx way and everything worked fine (did it a couple of weeks ago). Then I switched internet providers and had to setup the vacuum again. I also did the bluestacks procedure again and now I have an empty rr_tuya_xxxx, but I have a filled rr_rr_xxxx.

This is with the Roborock S5 max. Maybe a roborock update broke the tuya file?

edit: The previous devId and LocalKey doesnā€™t work anymore btw.

edit2: Tried with a fresh BS instance and still donā€™t have a filled rr_tuya_xxx

Your vacuum uses a camera, right? Iā€™ve heard this probably is the reason there is no tuya yet. I recon they want it super secure. (Which probably means integration will be harder)

Hi, read this topic and managed to get the S5 show up as an entity in HA. I also had to run the apk add npm in the homeassistant container. Now Iā€™m also seeing the vacuum service and showing for example zones. How can I learn what room on my map is which zone or segment? How can I trigger the S5 to start cleaning?

Hey yeah, you definitely have got a point there. Got quite a large firmware update yesterday though, so I might give it a try later this week to see how it behaves :slight_smile:

The trigger is vacuum.start in homeassistant.
Iā€™ve not been able to use map (yet) for s5 max with the roborock app (not mi or xiaomi) key integrated in homeassistant

1 Like

Discovered my segments by just testing them one by one :slight_smile:

Great work on the plugin. Works quite well.

I dont know if its related but for some reason the maps wonā€™t show anymore in the Android app after i added the vaccuum to HA. Could be coincidence ( they worked at first but now it is failing )

A tip for the people that run homeassistant in kubernetes;
add a lifecycle policy that adds NPM after pod starts.

lifecycle:
  postStart:
    exec:
      command: ["/bin/sh", "-c", "/sbin/apk add npm"]

edit; i think there are general issues with the roborock services that prevented the maps from showing up. they are now working and unrelated to this custom component.

I think there is actually an issue with the maps after adding the roborock to HA (s5 max here).
On Wifi/LAN the maps barely load in the roborock app. It timesout after a while but sometimes it works for a short period.
On 4G/mobile internet it works flawlessly!

Could it be that the integration in some way interferes with direct connectivity via roborock app in the same LAN?

Potentially that is the case. Might be some kind of interference due to calls from the same key.

Annoyingly soon after finishing this I have moved into temporary accommodation and the vacuum is in storage, so unable to do much with it.

Happy for anyone to contribute, and should be able to oversee. I will take a look @ any PRs etc. And can point people in the right direction how it works

I donā€™t have the same experience. My maps keep loading as ā€œfastā€ as always in the app. Nothing changed since I added my Roborock to HA last week.

Another thing, when I was looking at Roborock android app source. The maps is all done via React Native. So would be very hard to reverse engineer / migrate. Unless someone has done that kind of thing before. I do know JS quite well, but React not so much

I have the S5 Max and my Home Assistant docker running with NPM with a dedicated dockerfile but when using bluestacks to get my needed tokens from the Roborock app version 2.3.26 i ran into problems i canā€™t seem to solve

When gzipping the folder then the rr_tyua_xxxx contains an empty list but I found another file rr_rr_xxxxx that contains:the fields below like @afawaz / @Loony1 / @moto2000 did someone found a solution for this?

localKey 
duid
id, key, productId ( same key )
roomId 

This is the available JSON String (changed some keys/information). One thing to notice is that tuyamigrated is false:

[{"activeTime":1609758228,"displayOrder":0,"duid":"6jtILnvV27chh9ane3SZab","extra":"{\"xxxx\": \"xxxx\"}","fv":"01.10.26","iconUrl":"","isShare":false,"localKey":"ZNNLKPc8DXTuse4E","localOnline":false,"name":"Roborock S5 Max","online":true,"productBean":{"attribute":0,"capability":0,"category":"s6","code":"s5e","id":"49qZXusGAhtBh4L3Sb4SOV","key":"49qZXusGAhtBh4L3Sb4SOV","model":"roborock.vacuum.s5e","name":"Roborock S5 Max","schema":[{"code":"rpc_request","id":"101","mode":"rw","name":"rpc_request","type":"RAW"},{"code":"rpc_response","id":"102","mode":"rw","name":"rpc_response","type":"RAW"}],"wifi":false},"productId":"49qZXusGAhtBh4L3Sb4SOV","pv":"1.0","share":false,"shareTime":0,"timeZoneId":"Europe/Amsterdam","tuyaMigrated":false,"tuyaUuid":"tsspjoc654kq5125c9255"}]