Hi all,
Long time lurker, first time poster.
I have seen a lot of people over the internet asking about using the Roborock app and Home assistant at the same time.
I know that the general consensus is to move over to the Xiaomi app, and get the token etc, but I prefer the Roborock app, and have it setup with my family etc. So I decided to get it working.
I managed to reverse engineer the app, and work out how to communicate with the device locally which is actually an option in the code, I don’t know exactly why it doesnt use it, or if there is certain circumstances it will do it, maybe just for certain commands…
So I managed to work out, that instead of using the Xiamoi protocol (https://github.com/marcelrv/XiaomiRobotVacuumProtocol), that isn’t what it does any more.
To communicate locally with the device, it uses the Tuya protocol. It sends a DPS of 101, and a Base64 encoding of the the vacuum protocol (above). It does this using the device ID and the key (the same one that is used).
Furthermore, I have worked out how to get the map using Tuya mqtt server. I managed to get the details to log in to your account, but they seem to match this persons finding here in terms of how they are created (Link in second post). The mqtt command I am using to get the map is: -
mosquitto_sub -v -h m1.tuyaeu.com -u p******* -P ************ -t m/m/i/<roborock_device_id>
It is possible to subscribe, and by sending the get_map_v1 request (see first link) locally, it will make the mqtt spit out the encrypted map. It needs to be request with a new JSON object though: -
"security":{"endpoint":"****","nonce":"<AES generated key>"}
It is possible to retrieve the “endpoint” from SharedPreferences.
I have a python script that can take the data from the map and decrypt it so it can be used with RoborockMapViewer.
So, next steps:
I have created this git repo with the script for decrypting the map (https://github.com/89jd/roborock_comms). I will add to the README at some point the findings from this post.
I am not sure on the best way of making it possible for everyone to be able to access the values that come from the app, that are needed to make all this possible, so interested in hearing what everyone thinks about that.
Took a fair bit of effort to get to here. But good to know that it is still all possible to do local comms with roborock, and to get the map without having to root it.
Cheers