Carrying on the conversation from here, regarding Xiaomi devices and the Mi Connector app. I'd been struggling to keep my Xiaomi contacts and motion sensors connected for a while now. They were always solid for me on ST, and for a long while HE too, until the past few months that is.
I decided to remove them all and restart building my Zigbee mesh, throwing in 3 Xbees along the way. Even with the Xbees, they wouldn't stay connected, so I removed them for good. Then I came across @fison67's Mi Connector app and wanted to look into this further. After buying two Xiaomi hubs, which neither would work with Mi Connector, I took a last stab and bought an older version, model DGNWG02LM (I can’t say this will work for all but has done for me). Although this hub is working for me.
There’s a very long thread on ST regarding Mi Connector, which is worth a read.
The app and instructions are here
I'm running the app on my QNAP docker (feel free to PM me if you have questions), which isn’t so far away from the instructions in the link above for the Synology NAS. Or you can run the app on a PI.
You also must set the Xiaomi mobile app into developer mode, which can be tricky if you can’t read Chinese, but there are many posts around on how to do this. The app could find my Xiaomi hub fine; however, it couldn’t obtain the token from it (which is required). You can obtain this once you have the hub in developer mode manually. Some simple instructions here for that.
Here is what I did.
Open the Xiaomi app, and select your hub.
Select More Options.
Select the 3 dots at the top right
Tap in the middle of the screen a few times and a menu will appear
Some options are in Chinese, select the one below to enter the network options
Set the switch to on.
Some say note your password below the switch, although I haven’t needed that as yet.
Back in the options, select the next option down, this will give you the Token for the hub (this is needed).
Hit the bottom right button which will copy all text, open a mail and paste in the details and mail it to yourself. The Token is needed for the next step.
In the Mi Connect app, select "Manage Devices", "Device List" then "Add".
Add your Hub IP and paste the token in from step 9.
Go to "Add Devices ST" and you should see your hub listed. At this point you need all the required drivers in HE from GitHub.
Once the drivers are installed in HE, you can select the devices in the Mi Connector App and then register them. They should then be passed to HE for you to rename.
Try to make sure the Xiaomi hub you buy will work, this is the tricky part. I found that model DGNWG02LM works for me. The Aqara version will not work, and you also need to have the Xiaomi server set as Mainland China (I believe you can block net access once installed, if you’re worried about sending data to their servers, although I haven’t tried this yet)
If your devices aren’t being found on the Mi Connector after adding to the Xiaomi app, restart your docker or PI. They should then appear.
If you try to register a device in Mi Connector and receive an "undefined" error, then you don’t have the correct driver in HE.
The devices add process will add generic names to the devices in HE, but the DNI should point you to which device you are dealing with (see the details you mailed to yourself in step 9). If adding a few devices at once, it can be tricky to understand which device, is which.
But many thanks to @fison67 for a great app, and helping me keep my Xiaomi devices, and not relegate them to the "spare parts" box