recently I had to reconnect my Mi Robot (V1) to my Wifi.
As always, a new secret token was generated.
The problem: over the time Xiaomi made it more and more difficult to get this token to communicate to the robot with openHAB.
I found a lot of hints on the internet how to get the token (also here) and really none worked for me. And most of them have some major disadvantages. Just to metion a few:
installation of a russian, modded version of the Mi Home app. Honnestly, You have to trust the developer to do so. And besides it did not work for me (constantly plugin error)
rooted phone needed. I don’t want to root my phone for thiis… and you have to deal wth some SQLite manager and it only works with some versions of the Mi Home app
adb shell: finally to complicated to get it working with a specific phone
Finally I found a relatively easy solution which requires no modification on your phone and it is also an option for iphone users… I just wanted to let you know this option.
Step by step but the short version. The details are more or leess self-explaining.
The easiest way now is to get tokens is… OH…
From version 2.5.5 onwards you can simply enter your Xiaomi user ID / password in the binding config and the token will be pulled from the cloud.
That’s great!
This will ease the whole thing A LOT.
I assume you refer to the version of the binding … which will be shipped together with the next OH update right (using OH on Ubuntu server x86_64)?
Currently the blnding still expects the plaintext token to be entered…
Well, by now the current version I think is 2.5.7, but indeed I was refering to the version of the binding/OH.
The thing configuration hasn’t changed, it still expects the (hex) token.
When you enter the credentials, it will get it during discovery.
It also saves a json textfile in the runtime/miio folder with the token(s)
China country code = cn not ch (Switzerland). So if the mihome app has Mainland China use cn BTW, If you can’t find the right server you can also leave the field blank, it will try all known country servers.
Could this be done with the Xiaomi gatways? (I know thats not the binding you´re responsible for. I just wonder if this would be possible to get the gateway token as well).
If you have one, give it a try… It will show up as unsupported device, but that would not stop it from getting the token and, if needed, send custom commands to it (like get_device_list or similar)
I have an older gateway. It´s connected trough the xiaomi (smart home binding).
But in my inbox I have 3 other devices, which appeared when I installed the Mi iO binding. Except for the gatway device, I have no idea what the other two devices are:
The first 2 are both related to your lumi gateway (there are 2 ways to discover these, that is causing the double entry, you can see they share the same deviceId / number between the brackets).
If you would enable the 2nd one (with token), you will see the token in the thing configuration.