Cannot connect Xiaomi Gateway (lumi.gateway.v3) to HA

How was your problem like? How do you find it was the router that block the multicast? May I know what is your router back then, and what is your current router now?

I don’t remember exacly, but first i had 1 router from my company of internet, then they changed my router and then the gateway didn’t appeared in HA, so I installed my old one to test, and with old one, the gateway discovered.

The one that blocked multicast was a livebox, then old one that i was using was a ZTE. Now i have a Unifi.

If you look in forum, about xiaomi gateway discovered problem, you can see about that some routers block the multicast. Ask a friend if has old router…

Look if configuration of hassio has bridge mode activated also…

Hmm… I’ve spoken to the live support of Tenda. Not the best customer support though… Waiting 30 minutes for an answer, and they just answer in two lines and disconnect my session… They said the router supports multicast, although I cannot find any setting regarding multicast in my router web-admin…

However, I will still try to find another router to check this out…

@garvarma what did you mean by hassio bridge mode? I’ve tried googling a bit about it, but still haven’t found any information about it… How do we check the bridge mode of hassio?

what did you mean by hassio bridge mode? I’ve tried googling a bit about it, but still haven’t found any information about it… How do we check the bridge mode of hassio

In my case i’m using HA in dockers option. In my case when i configure the docker, i need to put in bridge mode, that all devices works in the same network.

If you didn’t find anything, in google, then maybe is not necessary in your case.

Here you can find some info:

https://community.home-assistant.io/t/xiaomi-gateway-not-discovered/25030/68

https://community.home-assistant.io/t/xiaomi-gateway-integration-help-needed/28563/32

https://community.home-assistant.io/search?q=xiaomi%20gateway%20multicast

Sorry i must go now to work. Try to find other router from a friend and check this.

speaking of this docker thing… I went ahead and try to see whether my system is actually running on a docker… So, when I issue this command from SSH (putty), this is the result that I get :

Does that mean I’m running hassio in docker? If yes, how do I make it running in –net:host mode? I’m really lost here, and I’ve tried searching around for instruction to run the already-installed docker in host mode… Any help would be appreciated…

Well i don’t understand so much about hassio.

But first i will recommend try other router if in that case continue not working, then see other things, like bridge or maybe configuration of HA.

Hmm… I’ve tried using different router D-LINK L7-N-R2000 which have multicast capability (there’s a menu about that in the setting). But the error persist. It seems like the port 9898 is closed most of the time. It only opens for a second after I disabled-enable LAN access. I assume this is the bug of the latest firmware…

i dont think it is multicast issue. Cause multicast issue you still can discover the gateway but will keep give key error in the logs
Possible migateway bug.

Try this.

  1. turn off wireless communication protocol
  2. change the password by press the button(avoid password with L / i / o / 9 / g. Sometime, cant differentiate it.)
  3. turn on wireless communication protocol
  4. try connect using new password.
  5. if step 4 fail. Reboot your migateway and wait 5 mins after reboot. Then restart your home assistant.

Other things you can try is running hassbian rather than hass.io.
I has problem with hass.io which it only listen to my lan port and not my wireless.

You can also see the broadcast from migateway using ngrep

$ ngrep port 9898
interface: eth0 (192.168.xx.0/255.255.255.0)
filter: (ip or ip6) and ( port 9898 )
#
U 192.168.xx.xx:4321 -> 224.0.0.50:9898
  {"cmd":"heartbeat","model":"gateway","sid":"xxxxxxx","short_id":"0","token":"xxxxxxxxxxxxx","data":"{\"ip\":\"192.168.xx.xx\"}"}
#
U 192.168.xx.xx:4321 -> 224.0.0.50:9898
  {"cmd":"heartbeat","model":"gateway","sid":"xxxxxxx","short_id":"0","token":"xxxxxxxxxx","data":"{\"ip\":\"192.168.xx.xx\"}"}
#

thanks for the suggesntion @tyjtyj
I will once again try to disable-enable wireless comm protocol, changing the password…

I’ve tried ngrep port 9898 but I’ve waited 30 mins there’s nothing on port 9898… not a heartbeat from the gateway… I really think the gateway doesn’t want to open himself to the network…

Anyway, what is you nmap result to the gateway? could you please perform

nmap -sU 192.168.0.x -p 9898,4321 to your gateway IP?

I’ve tempted to try to install hassbian. But don’t know how to install hassbian on ubuntu desktop pc?

Seems nmap test not accurate

root@raspberrypi:/home/homeassistant/.homeassistant# nmap -sU 192.168.xx.xx -p 9898,4321

Starting Nmap 7.40 ( https://nmap.org ) at 2018-09-05 15:49 +08
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 1.04 seconds
root@raspberrypi:/home/homeassistant/.homeassistant# nmap -sU 192.168.xx.xx -p 9898,4321

Starting Nmap 7.40 ( https://nmap.org ) at 2018-09-05 15:50 +08
Nmap scan report for lumi-gateway-v3_miio4516xxxx (192.168.xx.xx)
Host is up (0.036s latency).
PORT     STATE         SERVICE
4321/udp open|filtered rwhois
9898/udp open          monkeycom
MAC Address: F0:B4:29:xxxxxxxxxxx (Xiaomi Communications)

Nmap done: 1 IP address (1 host up) scanned in 2.26 seconds
root@raspberrypi:/home/homeassistant/.homeassistant# nmap -sU 192.168.xx.xx -p 9898,4321

Starting Nmap 7.40 ( https://nmap.org ) at 2018-09-05 15:50 +08
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 0.80 seconds

Yes, nmap is rather unreliable over wifi… If you use cable like me, you will get far more success doing nmap.

I see you have port 4321 and 9898 open on Gateway… I never have those port opens, eventhough I reset the gateway multiple times, and disable-enable LAN access numerous times. I wish I could send you my unit to test.

Follow the instructions and use -Pn in your commandline.

How hard can that be?

Also, there needs to be a space between the IP address and the -p

Why are you obfuscating the IP address? Do you really think we can access your gateway by knowing your private IP address?

No, you cant access my GW over the internet but I dont like to expose my private ip to the internet(full stop).

There is a space there in my command line. I am not sure why when I copy and paste, it disappear.
It does shows the port was open for a while and then closed then open and then close…
I ran few times and sometimes it open and sometimes it closed. I just copy the 2 that shows different result.

hoedha, maybe you wanna try run on host computer rather than virtual machine.

Was it stated as closed or was it the Nmap couldn’t connect to he gateway? In my case using LAN cable I can always Nmap the gateway but it always return the state of closed on both ports.

I’ve tried running HA in VMware, in virtualbox, and in Ubuntu desktop pc as host… All result in same situation… Do I get a defective gateway?

Why the hell don’t you follow the instructions and run nmap with -Pn.

who is from hell again ?

I give up on trying to help you. You seem oblivious to suggestions.

@tyjtyj @nickrout please don’t fight each other. We are here to help others having problems (like me)…

Back to topic, I’ve tried running nmap using -Pn as suggested, but the result is the same… So I really guess there’s something wrong with my gateway which won’t open its port. I’ve disabled-enabled LAN access from dev-mode in mi-home but still face the same problem. I’ve found a guy in another city with HA setup and xiaomi gateway, so I may try to send him my unit to try on his setup, or ask him to send his gateway for me to try in my network…

Really strange… I wish we could flash (custom) firmware to the Xiaomi gateway…

root@hoedha-m93p:~# nmap -sU -Pn 192.168.0.108 -p 9898,4321

Starting Nmap 7.60 ( https://nmap.org ) at 2018-09-08 09:24 WIB
Nmap scan report for 192.168.0.108
Host is up (0.22s latency).

PORT     STATE  SERVICE
4321/udp closed rwhois
9898/udp closed monkeycom
MAC Address: 78:11:DC:B3:7D:98 (Xiaomi Electronics,co.)

Nmap done: 1 IP address (1 host up) scanned in 14.07 seconds
root@hoedha-m93p:~# nmap -sU -Pn 192.168.0.108 -p 9898,4321

Starting Nmap 7.60 ( https://nmap.org ) at 2018-09-08 09:24 WIB
Nmap scan report for 192.168.0.108
Host is up (0.22s latency).

PORT     STATE  SERVICE
4321/udp closed rwhois
9898/udp closed monkeycom
MAC Address: 78:11:DC:B3:7D:98 (Xiaomi Electronics,co.)

Nmap done: 1 IP address (1 host up) scanned in 13.99 seconds

Forget the rude people…

Here is my output

Host is up (0.024s latency).
PORT     STATE         SERVICE
4321/udp open|filtered rwhois
9898/udp open          monkeycom

Definitely something wrong with my gateway. It doesn’t open the port for communication. No wonder HA never been able to communicate with it… Ok… I’ll try to swap gateway with one of my friend… I’ll report back when there’s result… thank you all for you kind help and suggestion…

Hi all,

Got back with sad result from my friend. So he owns two xiaomi mijia gateway (same like mine). When he tried to integrate mine with his HA, his HA can never find mine. Nmap also showed that both port on mine is closed. Whereas, both of his gateway has ports open.

So I think my unit is a defective unit. I don’t know how to fix that. It seems like something wrong with the software inside, but I don’t know how to downgrade the firmware. I might be waiting for next firmware upgrade to try my luck.

Meanwhile, I’ve been ordered parts for zigbee2mqtt and hope that I get better luck with it.

But for curiousity I will also order the xiaomi gateway one more time, this time from the same seller as my friend.

A bit OOT, Xiaomi seems to release a new smart aqara hub. Anyone has experience with it?

1 Like