Open aholstenson opened 6 years ago
A solution is to install this modified MiHome APP : http://www.kapiba.ru/2017/11/mi-home.html Tokens are displayed in the app
For anyone with android struggling with token, I wrote up this guide. In short, you emulate a rooted android and get the database from it. No need to downgrade phone app.
Newer versions of some peripherals seem to change their token on wifi change. That means that the devices stops responding once the wifi is configured with the {"method":"miIO.config_router","params":{"ssid":"XXX","passwd":"XXX"},"id":X}
command.
My guess is that the device gets online once WiFi is set up and it generates/uploads a new token that the app can then access.
It would be interesting to see how the new token exchange occurs and whether the token renewal still takes place if xiaomi's servers are not reachable.
For anyone wondering, uninstalling any other Mi Home apps, clearing their data and installing Mi Home 5.4.54 (and restarting the phone) allowed me to get the token from the app's log files.
You will need to click on the smart device in the app for the first time so that Mi Home downloads the token and write it to the log file. The token can then be extracted from the log file that is located in the "Smart home" folder in the sdcard Android directory. After that I was able to control my stuff.
Hope this helps.
Newer versions of some peripherals seem to change their token on wifi change. That means that the devices stops responding once the wifi is configured with the
{"method":"miIO.config_router","params":{"ssid":"XXX","passwd":"XXX"},"id":X}
command.My guess is that the device gets online once WiFi is set up and it generates/uploads a new token that the app can then access.
It would be interesting to see how the new token exchange occurs and whether the token renewal still takes place if xiaomi's servers are not reachable.
I can (and did) verify this!
Prelude: I faced the exact same issue for the first time after buying a Mi Air Purifier Pro (zhimi.airpurifier.v7)
After about two hours of trying to repair with either my laptop or the old Android app I gave up and did the following:
Test output:
miiocli airpurifier --ip 192.168.100.174 --token <XXXXXXXXXXXXXXXXX> info
Model: zhimi.airpurifier.v7
Hardware version: MW300
Firmware version: 1.4.3_19105
Network: {'localIp': '192.168.100.174', 'mask': '255.255.255.0', 'gw': '192.168.100.1', 'gw_mac': '74:44:01:FC:0F:B0'}
AP: {'rssi': -48, 'ssid': 'LookingGlass', 'bssid': 'FE:EC:DA:2F:89:8E'}
dnsmasq.conf (super slimmed down)
port=0
interface=wlp2s0b1
dhcp-range=192.168.100.3,192.168.100.255,72h
How do you change the wifi? Via miio or the or pyton-miio (miiocli)? I tried this several times now and I can't get it too work. With this app I was able to extract the tokens from the yeelight app https://github.com/phrogg/GetMiTokens/, however my goal as well as yours is also to get this to work without the app at all. I used my normal network and just dc the router from the internet, was that wrong?
Hello!
I agree with @mitchins in case of purifier pro and 2s - the behavior is exact as you described in case of stub WiFi network without internet. But I have this issue (changing token) with Purifier 3H "fw_ver":"2.0.5","mcu_fw_ver":"0009","miio_ver":"0.0.5","hw_ver":"esp32".
Hello!
I agree with @mitchins in case of purifier pro and 2s - the behavior is exact as you described in case of stub WiFi network without internet. But I have this issue (changing token) with Purifier 3H "fw_ver":"2.0.5","mcu_fw_ver":"0009","miio_ver":"0.0.5","hw_ver":"esp32".
I strongly suspect it’s universal to most new xiaomi firmwares across many devices. Why do it for one when you can do it for all.
Managed to get new valid token for mmgg.pet_waterer.s1 from Xiaomi cloud via https://github.com/Squachen/micloud#in-terminal after initial miIO.config_route command
This issue is a collection and reminder to look over automatic token extraction and the documentation for how to get a token for things such as the vacuum cleaners and Philips Light Bulbs.
For some great information look into #40 and #80 which both contain information about alternative ways to extract tokens.