I have a lot of problems with Xiaomi Mi Smart Home Binding. I have done a lot of tests because all of the next problems appears to me with a Windows 10 computer… all of them are on diferent old posts. The consequences of all of this are the same: you can see the Gateway, you can connect but in a few minutes, all devices goes off-line. This is because OpenHAB needs to receive de heartbeat packets that are regulary send by Gateway.
1- Xiaomi Gateway don’t send multicast packets to 9898
. If this happens, you need to open Gateway Hardware, solder two wires with a serial port debugger and do some stuff. You can check if this is happening using Wireshark on promiscuous mode in the same LAN as Gateway and reading old posts with this problems (the detailed procedure is explained there).
2- Xiaomi Gateway is sending packets and “heartbeat” packets, but they don’t arrive to device with OpenHAB. Probably Router configuration. Not all devices work correctly with multicast packets, or could be deactivated. Check router configuration while read network packets in same network as OpenHAB is running.
3- Xiaomi is sending multicast heartbeat packets, you can see them on your computer with OpenHAB, but only in promiscuous mode. With the network card on “normal mode”, no multicast packets are received. This is hard to solve, I can’t give a correct solution, because I am not sure if is due a Router Configuration, a Routing configuration on PC (route table), or also due to the next problem (number 4).
4- You can see the heartbeat packets with Wireshark on normal (non promiscuous mode), but yet your OpenHAB disconnect the Gateway after a couple of minutes. Viewing the log of OpenHAB, you can see that it doesn’t reading heartbeat packets. This is due a bug on Binding, because it opens an incorrect network card to wait multipackets (I have read that try to open the first card, that is the loopback card). I think that this only happens on Windows machines. There are a “patched version” of Binding that opens a listening socket on every network card found… and with this! I am finally capable of connecting correctly with Xiaomi Gateway without disconnections. I don’t know if this bug (it is reflected on GitHub) is actually corrected.
BUT, I can actually read sensors connected to Xiaomi Gateway, but I can’t actuate to the Gateway, if I try to switch on the light for example, nothing happens… I don’t know why… More investigation time needed!