Xiaomi gateway(newer versions) connection to OH2

Dear mates

I know there is a lot of written stuff about the establishing the connection from OH2 to the gateway I already read a lot of not only on OH forums. I recently got my devce delivered and have attached it to my network and can get the date on the mobile app.
But I’m in no way able to configure the gateway in the way as described in the bindings docs.

OH2 version 2.5.5
Xiaomi Home app: 5.8.16
Plugin version: 1.5.2
Gateway firmware: 1.4.6_0012

I’ve read also the thread about soldering UART to the gateway in order to access the system with serial connection. Honestly I would try to prevent this. I don’t want to risk damaging the case. My device is a flat one and Micro-USB powered. Not as others shown in the thread [SOLVED] Openhab2 - Xiaomi Mi Gateway - does not respond with build in 230v plug.

Is there anyone of you having some hints for me.


I bought the xiaomi hub and some sensors recently and didn’t get it to work either. I tried pretty much everything…
To fix this I bought a Conbee II stick from Deconz https://www.phoscon.de/de/conbee2. It’s 40€. The stick then gets connected to openhab via the Deconz binding

This works pretty well.

Thanks @Felix_Schneider that’s at least an alternative idea. However my four USB ports on the server are already used and there are also three of them attached to the openHAB bindings. At some point it becomes difficult to use USB connections to control everything.

I mean there is huge amount of people working on SmartHome initiatives but there is still to much own box thinking.
OT end

I can access the gateway even through the outher space, beeing on the road, but I’m not able include it into the central control unit. Seems somehow weird…

As far as I understand, its due to a specific port beeing closed in the firmware. You´ll need to open that for the openhab bindig to find it, second there are some permission settings which I think needs to be altered. And last, you´ll need the token.
I dont think its possible to du beside going in hard-wired (serial interface). Why Xiaomi chose to do it like this, and not like the older gateway version is still in question. I have on of the older ones, and I have to admit, I have had thoughts about going away from these gateways, simply because I cant count on the one I have now will work forever. And changing to a newer version will end in the same situation you´re in.

1 Like

I recently suggested that you can try to use the miio binding to open the port. Once open you user the mihome binding and no longer need to miio binding.

Did not see anyone trying it yet, I think it worth a try. If that works it is much easier than opening the device and connect serial.

It would be a blast if it works for the newer gateways. Thats for sure.

1 Like

python-miio is able to control the devices, without the restriction on firmware as far as I can see.
Hence don’t see why miio binding would not be able to communicate with the device as it uses same communication method

I will give it a try with my gateway, Marcel. I first need to get some debug logging for the modbus binding up running first, cause there seem to be some serious issue with it. Then I´ll return to try the miio binding with my gateway.

Guys I just managed to enable the telnet access :slight_smile: using the python-miio

miiocli -d gateway --ip --token 7935446950514d48555454444f717a76 enable_telnet


DEBUG:miio.miioprotocol: (ts: 2020-09-02 19:08:02, id: 102) << {'code': 0, 'result': ['ok'], 'id': 102}

So from here I hope to fix the next point.

Interestingly the token for the gateway was changed througout the log and the first tries to run the command failed.

and login with telnet worked !!

Nice! I would do the same thing if I hadn’t just thrown the gateway away after I didn’t get it to work :sweat_smile:

What is the next step?

Next step is to find out how to activate port 9898 on the device or find another approach to do the same.

I can see that 9898 is not active listening…

As on other pages written, the system on this version of Mi Smarthome hub (gateway) also referred as v4 works differently. And there seems to be no way to get a developer key from somewhere. Further more I cannot identify which service on the device would be related to to port 9898.