miio icon indicating copy to clipboard operation
miio copied to clipboard

Any way to get token for Air Purifier 2S?

Open dzonibg opened this issue 4 years ago • 6 comments

Hello,

As the title says, is there an easy way to find the token? Should I connect to my purifiers own wifi or the home wifi it's connected to? My device code should be "mc1".

"miio discover" takes forever and doesn't find anything.

dzonibg avatar Oct 05 '19 16:10 dzonibg

Hello. Are You on the same network with Your Purifier? Also, if You want to get the device token, You have to reset it before discover. After reset, Purifier won't connect to Your router but will make it's own wifi network. You have to connect to that network, then use miio discover.

It works for me (I have AP2s too). I am just stuck with other problem - after setting my purifier up it connects to router and then changes the token ;-)

dottoreFell avatar Oct 05 '19 23:10 dottoreFell

Thanks for the straightforward reply.

Yeah, I'm on the same network as the AP2S, tried both discovery methods from the JS code, none of them worked, nothing showed up even after ~20 mins or so.

So, the only way to make the AP work is to use it either via Mi Home app or somehow stay connected to it's own network? That doesn't seem good at all. Mostly what I wanted is simple automation with the AP turning off when the PM2.5 value is low and running when it gets higher, but Mi Hope app doesn't allow that rule on the EU models. And changing region to China doesn't work since you can't add an EU model to China servers. They really made a mess. Read a few posts and there is no workaround.

So, basicly, you can't use CN and EU Xiaomi products on the same account, and there is no official API. Really wonder why they locked it down so bad.

dzonibg avatar Oct 06 '19 00:10 dzonibg

Have You tried discovery with the commandline tool? It worked for me. My version is zhimi.airpurifier.ma2 though (chinese). I can use it when connected to its own network, but that's totally unsafe - anyone can detect and steal it anytime. I am lookong if there is a way to sniff token during communication between app and the device,, but I am not good at those things. I am too very dissappointed with the changes they are recently making to the app and the firmware.

dottoreFell avatar Oct 06 '19 10:10 dottoreFell

You might want to check here.

I extracted Mi Home sqlite db from uncrypted iOS backup and got token from it.

bekker avatar Oct 07 '19 08:10 bekker

I didn't want to install anything from third party websites to my phone, but I gave up. I have installed Mi Home 5.4.49 from www.apkmirror.com and took token from logs in the way that is described here.

Worked perfectly.

dottoreFell avatar Oct 07 '19 13:10 dottoreFell

Yeah, deffinitely the easiest way to get the token. Works perfectly for me too. Though I switched to Home Assistant and Hassio for automation.

Also, it auto updates to newest version when possible, but the file containing the token stays in the directory. Guess it's not a "malware" file on apkmirror.

dzonibg avatar Oct 10 '19 16:10 dzonibg