[SOLVED] Openhab2 - Xiaomi Mi Gateway - does not respond

According to previous image, old gateway,
1 year and several months

Hi @asking. Thanks for the very helpful post!

As @wojciech.fred has requested, can we get a check in with people in the table above to fill in if you have the round text or square text please? In particular it would be interesting to get some responses from both working and non-working people.

@Jensen, @Dominik_Jeziorski, @wojciech.fred, @dimalo, @Jebo, @bartsnijder, @Olymp & @rsx2007.

Thanks for your cooperation :smile:

Round text

Square and working.

Round and working… BUT still on fw version .159 so this won’t give you much more extra info I guess

Here are my inputs to fulfill the table :
MAC Adress : 78:11:DC:XX:XX:XX
FW : 1.4.1_161
RT/ST : RT
WPPU : Y
Working : N ;( (and never have)

server : Mainland china

Rounded text and of course not working ;).

Hi guys,

On the HA forum I read about somebody getting it to work again. I did not do any deep investigation and I cannot try myself since I’m still on old working FW but those with problems please give it a try.

Just got a new gateway from Gearbest. I took it out of the packet and noted it has the round text (not a good start). Out of the box it seems to have _143 FW. I connected to the AP it was broadcasting and ran nmap; only port 54321 was open. I then used the MiHome app to connect the gateway to my network. Again; ignoring the update messages, I enabled developer mode and then ran nmap again. Low and behold port 9898 is now open and I can see it broadcasting to 224.0.0.50:9898 periodically.

UPDATE Verified working with openhab. Could not add my double switch, so I held my breath and performed the update to _161. I’m happy to report that the unit continues to work on _161. So… where does that leave us?

It has to do with FW 1.4.1_161.0143

FW 1.4.1_159.0143 has always been reported to work fine for all units

Please double check

Hi @bartsnijder,

@rsx2007 reported it not working on _157 and _159 also…

I can confirm my new unit works OK on _161 . :tired_face:

so… looks like this is hardware problem?

I don’t think it is necessarily hardware. In fact given current results, I’d say it is still very much inconclusive.

I set up a newer unit (round text) last night; turned on developer mode first, then updated and the unit is working.

The first gateway I tried (has a very similar MAC address; I wouldn’t be surprised if it was manufactured in the same batch) I upgraded first and then enabled developer mode; but it is not working.

My original theory was if you updated with developer mode switched off, then it disabled it more permanently. However @Alex44 has said that they switched developer mode on first and they have a non working solution… so looks less likely.

Can I re-iterate to anyone trying to figure out if their device is working; please run a few checks. It seems that the easiest check is to run nmap and check port 9898/UDP is open (nmap -sU -p 9898 192.168.??.??). It took me a few goes to get my second gateway working in openhab, but I knew I was on the right track because I could see the open port (I also ran tcpdump on my router and could see it broadcasting packets on 224.0.0.50, but I can appreciate a lot of people may not have the ability to do this).

Hello everyone, I didn’t tried to use OpenHab platform yet, but I think we all have a same issue. I confirm that my gateway with round text and latest firmware doesn’t work.
I bought it about 3 weeks ago, and the first thing I’ve done after connecting to mihome - was update, and I didn’t turn on a debeloper mode before it
Now I have closed 9898 port
Router supports multicast, from packet capturing I can see a heartbeat that lumi gateway is sending, every minute, after that my HA instance is trying to ask 9898 port and never gets a reply
Only one thing that I could force to work was a xiaomisecuritygateway plugin for HomeBridge, that can switch an alarm mode on lumi, it works fine, I didn’t open a config files of that plugin but I think it works through 54321 port.

Hi people,
I am new here. I have also received a gateway these days with the round text. Bad luck … it is not found by OH. I also updated directly when I plugged it into the wall. :confused:

What I can see in Wireshark is that the Gateway doesnt send UDP messages to 224.0.0.50:9898 but on 224.0.0.251:5353 … can someone with a working model look what is sent over port 9898 ?

My Gateqys IP is 192.168.31.184

1584 190.684905150 192.168.31.184 224.0.0.251 MDNS 360 Standard query response 0x0000 A, cache flush 192.168.31.184 SRV, cache flush 0 0 54321 lumi-gateway-v3_miio98878811.local TXT, cache flush PTR lumi-gateway-v3_miio98878811._miio._udp.local

This is what is received (masked my mac whyever):
^û|Ië°³=EZ¦ÿ÷À¨¸àûééFHlumi-gateway-v3_miio98878811localÿÀ¨¸lumi-gateway-v3_miio98878811_miio_udplocal!ÿÔ1lumi-gateway-v3_miio98878811locallumi-gateway-v3_miio98878811_miio_udplocalÿepoch=1mac=7c49eb*****_miio_udplocalÿ/lumi-gateway-v3_miio98878811_miio_udplocal

Hope that helps us

edit:
suddenly I found out that this is (only) a Multicast DNS message. So I dont think it has to do with the not corresponding port 9898. When I penetrate the gateway with nmap most of the time the port remains closed but some times it gives me an opened status.

edit 2:
Bad news is I still did not manage to get anything over port 9898 by UDP. Good news is that the gateway seems to respond to the MIIO node module. A bit scary is that I will get more information when I connect directly to the wifi of the gateway (before it gets paired with my home wifi).

Directly connector before wifi pairing:
C:\Development\miio>node ./node_modules/miio/cli tokens update 192.168.13.1 --token e36451b32c652aee51eabc65243214
INFO Updating token for 192.168.13.1
->: Singlewire Software Packet 15527
->: Singlewire Software Packet 15528
MiioDevice {
model=lumi.gateway.v3,
types=sensor, miio:gateway, miio,
capabilities=illuminance, state, children
}


Already connected over home wifi:
C:\Development\miio>node ./node_modules/miio/cli tokens update 192.168.31.184 --token e36451b32c652aee51eabc65243214
INFO Updating token for 192.168.31.184
D: MiioDevice {
model=undefined,
types=placeholder, miio,
capabilities=
}

INFO Connected to miio:98878811 - trying to change token

->: Singlewire Software Packet 18997
->: Singlewire Software Packet 18998
Token has been updated


The text “Singlewire Software Packet” is what gets received after the UDP connect. As far as I see from the miio code there should alway be an JSON-Object what gets received, but here we get a simple string. That’s curious… I don’t know the protocols before because I am new to all this, but it looks like some protocol change to me .

I am going on to look if the miio extension will do the job and report my success. As I saw there were updates 3 days ago on github.

cheers

next edit:
i successfully compiled in eclipse and got the miio binding running. Unfortunately it only shows up power on/pff and s.th. with test exec cmd atm.


sorry for the bad picture

THe protocol for this is described here if I am right: http://docs.opencloud.aqara.cn/development/gateway-LAN-communication/

This is miio protocol.
Like in vacuum cleaner and so on…
You can control light, but you cant manage connected device or parse data from them.

Hi!
I have a square gateway text.
I upgraded to 161 and it seems to be working fine!

Hi @Andreas_J, just clarifying your questions (quick summary). There appears to be two modes of operation for these gateways. It doesn’t appears possible for a device to go from mode 2 to mode 1.

Mode 1 (working): The gateway has port 9898 open. The gateway occasionally sends a broadcast message to 224.0.0.50:9898. In addition whenever something happens (motion detected or switch pressed for example) a broadcast message is sent.
The most important thing is that the broadcast messages are sent in this mode of operation. The reason I’ve suggested to check port 9898 is just because it is an easy way to diagnose which mode the gateway is in (seems to reliably indicate which mode).

Mode 2 (not working): The gateway’s port 9898 is mostly closed (sometimes it appears to be open when configuring the gateway). No multicast messages are sent. Port 54321 is open (MIIO protocol) which allows you to send messages to the device, but does not allow the gateway to send asynchronous messages when events occur.

1 Like

Hi! So, is it 100% safe to upgrade gateway with square text?

By the way, does anybody have an official changelog for 1.4.1_161 version?

Thanks!

There has been at least 2 other reports of it working OK on 161. In addition, my second unit from Gearbest has the square text and it is working correctly (on 161).