Xiaomi gateway network problems

I have one Aqara switch so far which has been working great for 2 weeks on hassio and on its own app, but tonight it was playing up. I checked the app and it couldn’t connect, said check network, can the zigbee network go down like wifi can ?

possible issues:
zigbee / wifi 2.4Ghz interference
battery failure on the switch (is it mains or battery powered)
distance from the xiaomi gateway - press the pair button on the switch and the gateway should talk to you if it is paired…

Its a mains switch and is about 2M from hub, might be wifi interference though, I’m on channel 7 but the neighbour is on channel 10, which might be to close ?

If you mean cant connect via the mi home app, it connects to the gateway via wifi not zigbee.

Good point - was it the app saying it can’t connect to internet, or to the device?

app on phone → wifi → china
app on phone → wifi → hub → device

I think it was the ZigBee network as after I posted the switch disappeared altogether and I had to repair

When it gives you error, first thing is to try to ping it.

ping -c10 <IP_GW>

and check for packet loss.

Interferences could be: your wifi <-> neighborhood’s wifi but also your wifi <-> your ZigBee.
Check on MiHome app which channel your gw is using (developer mode->info) and stay away from that channel with your wifi network

Also check if the gw has still open doors:
nmap -sU <IP_GW> -p 9898,4321,5353,54321

I am facing same problem and I think it’s something related with my network: as soon as I change wifi channel everything si working good.

Right now I have a ping cron job with alert, in case of packets loss so I can change the channel as fast as I can.
I dont’ know if with as something to do with multicast as well (5 sonos using multicast in my home).

I am seriuosly thinking to trash the gw and using the Zigbee key.

1 Like

I tried pinginig and out of 5000 packages it lost 2, but I have set a simple automation that turns off the light 2 mins after I switch it on using the Mi home app. I assume this would be saved onto the gateway and only use the Zigbee network. Twice last night the light didn’t turn off

I am monitoring it, as well!

Today I had no disconnections but his light went unavailable and I noticed some little flaws: one motion sensor remained to ON.

  • No packets loss from it
  • All doors are still opened
  • Restarting HA seems to fix the problem for a while

I bumped into this discussion:

It seems that if the gateway is blocked to the outside it acts strange (mine is blocked).
I keep an eye on that!

BTW: I have firmware 1_4.1_161.0143

Ok, I saw this:

  • internet is blocked to the Gateway
  • I don’t use MiHome app (I even don’t have it on my phone)

In the past three days everything worked but his light went to unavailable different times (no big deal!)

Today, my log was filled with :

2019-01-14 09:07:22 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.plug_158d0001bc2dbe is taking over 10 seconds
2019-01-14 09:07:22 ERROR (Thread-4) [xiaomi_gateway] Cannot connect to Gateway
2019-01-14 09:07:22 DEBUG (Thread-4) [xiaomi_gateway] read_ack << None
2019-01-14 09:07:22 ERROR (Thread-4) [xiaomi_gateway] No data in response from hub None

The ping was good (0% packet loss) but I had:

Starting Nmap 7.40 ( https://nmap.org ) at 2019-01-14 09:03 CET
Nmap scan report for GatewayXiaomi.fritz.box (
Host is up (0.039s latency).
4321/udp open|filtered rwhois
5353/udp open|filtered zeroconf
9898/udp open|filtered monkeycom
54321/udp open|filtered bo2k
MAC Address: 78:11:DC:XX:XX:XX (Unknown)

So, port 9898 changed from open to open|filtered

As soon as I opened internet to the gateway, the port changed again to open and the switch.plug_158d0001bc2dbe started to talk with the gateway again!

I don’t know if it is a bug or something else but I don’t like it at all!
I am going to change this hub with something else!

I’ve read elsewhere that devices can go offline if hub is blocked from internet, and as for not trusting it, well most electronics are made in china, and Xiaomi is a big established company