Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get map from xiaomi servers? #42

Open
messimm opened this issue Nov 25, 2020 · 4 comments
Open

How to get map from xiaomi servers? #42

messimm opened this issue Nov 25, 2020 · 4 comments
Labels

Comments

@messimm
Copy link

messimm commented Nov 25, 2020

Is it possible to get mapping from Xiaomi server?
I know my region: sg.
I send GET-request to https://sg.api.io.mi.com/app/home/getmapfileurl with obj_name parameter which is the same with result of get_map_v1 method. It doesn't work. I try to concatenate roboroommap%2FXXXXXXXX%2FX (X from digits) and URL. It doesn't work too. What Do I do in wrong way?

@marcelrv
Copy link
Owner

yes, it is possible, but you need to make sure the request is properly signed with the security keys
In the response you get the right (temporary) URL where the robotmap can be downloaded. It is to simplistic to just try to try to download the roboroommap%2FXXXXXXXX%2FX file directly from the server, without the required cookies/signatures.
You can look into openHAB source to get idea of the request to make.

@messimm
Copy link
Author

messimm commented Nov 27, 2020

Thank you for reply! Sorry, one more question. How do obstacles recognition work? Do it depend on vacuum cleaner model? Or it is result of processing by Xiaomi servers?

@dsbabkov
Copy link

Help me please. How should I concatenate urls?

I have roborock S6 and got in get_map_v1 response rubysc1%2FXXXXXXXXX%2FX

My region server in MI Home is Russian. Vacuum was removed and added again to MI Home after setting the region. Seems my url is https://ru.api.io.mi.com/app/home/getmapfileurl

I have no experience of requests... I have tryed to input to adress line of chrome https://ru.api.io.mi.com/app/home/getmapfileurl/rubysc1/XXXXXXXXX/X and https://ru.api.io.mi.com/app/home/getmapfileurl/rubysc1%2FXXXXXXXXX%2FX but server responses "404 not found" ...

@gjuhasz86
Copy link
Contributor

I have been experimenting with this recently, and created a gist that can help downloading the map.
The basic underlying mechanism is that you first send the requests to log into the Xiaomi account and obtain the service token as well as other security keys and cookies, then make a POST request to getmapfileurl with the map name and some other parameters encoded in the url, then that service will reply with the actual url that you can use to get the map data.
If you start with the gist mentioned above, you can find out all the details by following the calls (it uses a python api).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants