Xiaomi Gateway and Hass.io

Hello,

Yes, another topic about the Xiaomi gateway… im sorry guys but i had to, the other topics i found didn’t had an answer for me and were long (and yes ive read all the replies over the last days…)

Im currently automating my parents home and thats all going fine. First time running hass.io on a raspberry pi 3 (at my own place i’m running home-assistant installed on a ubuntu vm), the only thing which i cannot get to work is the Xiaomi gateway that i want to use.

I’ve setup the gateway with an Android phone (i read that iOS can give trouble) and that worked all fine connected some switches and door sensors and everything works nicely inside the “Mii home app”. (note; my country is on Mainland China)
In the app i went to setup LAN access and copied the key and started to configure it in my configuration.yaml file.

Currently i have the following block of configuration:

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - key: 6sxxxxxxxxg7h
      mac:
      host: 192.168.178.18

I use the git addon on hass.io to pull my changes and after that i restart hass. The next thing i constantly see is that its failing to initialize the gateway. Im not getting the error that the key is incorrect.
I tried several combinations already, only key, only mac and key, host and key, and like above with mac empty.

By reading the docs and some other topics regarding the gateway i read that multicast can be an issue? My parents have a router from their ISP and a TP-Link something wifi router which they use as a wifi access point, the DHCP is taking care of by the ISP router. On both routers IGMP Proxy is enabled. I didn’t find any other multicast option.

Would this be an network issue, maybe hassio?
It would be great if anyone can point me in some direction or had this issue before that can help me out. I can provide more debug info if needed.

Thanks in advance,
Rolf

sounds very similar to this thread, that turn out to be a faulty gateway in the end.

That sounds indeed very similar! I will bring my own gateway to their place (will go through the pain of resetting it here at home again) to try if that one works. Will try it tomorrow.

Try to Nmap first your faulty gateway…

Nmap -sU 192.168.x.x -p 9898,4321

Compare with your working gateway…

I tried my own gateway at their place and im still having the same issue…

Home assistant is telling me the following errors:

  • Setup of xiaomi_aqara is taking over 10 seconds.
  • No gateway discovered
  • Setup failed for xiaomi_aqara: Component failed to initialize.

Like @hoedha suggested i tried to nmap both and this are the outputs:

Response from parents gateway:

$ sudo nmap -sU 192.168.178.18 -p 9898,4321
Starting Nmap 7.70 ( https://nmap.org ) at 2018-09-26 10:33 CEST
Nmap scan report for 192.168.178.18
Host is up (0.051s latency).

PORT     STATE         SERVICE
4321/udp open|filtered rwhois
9898/udp open          monkeycom
MAC Address: 34:CE:00:90:92:EE (Xiaomi Electronics,co.)

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

Response from working (at my own place) gateway:

$ nmap -sU 192.168.178.32 -p 9898,4321
Starting Nmap 7.70 ( https://nmap.org ) at 2018-09-26 11:39 CEST
Nmap scan report for 192.168.178.32
Host is up (0.066s latency).

PORT     STATE         SERVICE
4321/udp open|filtered rwhois
9898/udp open          monkeycom
MAC Address: 34:CE:00:85:3D:AA (Xiaomi Electronics,co.)

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

I have the feeling that its a network issue, i just tried adding their LG TV home assistant is also not able to discover the tv. So or its the network or its hassio on the pi that for some reason cannot access other devices? Its connected with the Philips Hue though that works fine…

… What would be next?

Replace the TP-link, if I remember correctly several people reported issues with TP -link devices in combination with the Xiaomi gateway.

Hmm since my dad recently bought that device im not sure i can… I can try creating another wifi hotspot on the ISP router and connect the gateway to that one to see if that works.

Your Nmap results are normal for both gateway, I would suggest to check your parent gateway in your home network. If needed perform tcpdump or ngrep to see whether multicast traffic can be transmitted or received successfully.

I’m going there again today. I will do some ngrep to see the multicast traffic and like @sjee suggested i will try to disconnect the TP-Link from the network and see if that helps. Will report back later today with some results.

I have removed the TP-Link device from the network but still im not able to connect the gateway from within home-assistant.

By running ngrep for port 9898 im not seeing any traffic coming by.

I only re-enabled LAN mode for the gateway, it wouldn’t be necessary to reset and re-connect it to the network i guess?

// Edit:
Also after trying the other gateway and hard resetting it no success yet.

The router they got from their ISP is a ; Cisco EPC3925

Same to me