Anyone lose access to their Xiaomi Aqara gateway today?

Downgraded all wireless and switches, still no go. Tried every combination of key, mac, host without success. Can ping gateway and control it from Mi Home App. Re-generated api key several times in app, updated config and restarted, still no go. Lost now.

I’ve now ordered a Conbee II from Amazon so I’ll be offline with 30 odd sensors for 2 weeks while I await its arrival. Be nice not to have to rely on the Xiaomi Hub.

optional with one gateway, mandatory with more than 1:

vol.Optional(CONF_GATEWAYS, default={}):
    vol.All(cv.ensure_list, vol.Any(
        vol.All([GATEWAY_CONFIG_MAC_OPTIONAL], vol.Length(max=1)),
        vol.All([GATEWAY_CONFIG_MAC_REQUIRED], vol.Length(min=2))
    ), [_fix_conf_defaults]),

thats really strange.

I guess you couldn’t get any useful debug? (or way too much!)

good luck

Might be easier to quote to the docs as not everybody reads the source code :wink:;

mac
(string)(Optional)The MAC address of your gateway. Needs to be formatted without “:”.
Optional if only using one gateway.

That’s a bummer. I’m making some network changes soon and will likely need to reset one of the hubs, this makes me nervous.

I have a few cc2531 sticks on standby just in case but honestly I preferred using the Xiaomi hubs rather than mqtt.

Yep, it seems the gateway reset has screwed it up. In my efforts to get it talking to the Mi Home app which wasn’t really necessary now that I think about it, HA will no longer talk to it. I even sparked up another HA instance on a Pi to test and that couldn’t see it either. Lesson learnt. If it ain’t broke…

I’ll switch to Deconz and see if that is a better long-term solution.

Nope, nothing useful when I changed the log to debug. I had the same issue with non-visibility of the xiaomi hub when I tried installing HA in Docker on my NAS many months ago. It’s the reason I gave up with Docker for HA and Node Red.

I’m now running HassOS on NUC i3 and apart from this (not so little) issue today, it’s been rock solid.

SOLVED! Turns out an update effects the gateway when it’s reset or something along those lines and the UDP ports required for HA access get closed.

From a Linux machine on the network, run this command.

sudo nmap -sU 192.168.xx.xx -p 9898,4321

If both ports say closed, you have to crack the unit open, solder three wires and connect a serial converter to send it a command via PuTTy. Fortunately I’m a hardware guy and I’ve flashed many Sonoff’s and other devices so I’m well versed at this.

The solution is documented here https://community.openhab.org/t/solved-openhab2-xiaomi-mi-gateway-does-not-respond/52963/126

There is also another HA thread with tons of information on this issue here.

Once done, you should get the following back:

pi@pi-plantgateway:~ $ sudo nmap -sU 10.0.1.20 -p 9898,4321

Starting Nmap 7.40 ( https://nmap.org ) at 2019-06-01 23:34 NZST
Nmap scan report for 10.0.1.20
Host is up (-0.12s latency).
PORT     STATE         SERVICE
4321/udp open|filtered rwhois
9898/udp open          monkeycom
MAC Address: 34:CE:00:00:00:00 (Unknown)

Glad you got it sorted. So resetting your hub switched off the developer mode, and when enabling developer mode again the firmware bug was preventing the ports from being opened? I had thought that developer mode was persistent across a reset, so that’s a bummer.

I’ll have to keep the SSID of my network the same so I don’t ever have to reset the device… Although I’ve soldered and flashed sonoffs, my actual soldering skills aren’t that great and I don’t like the idea of connecting a mains-powered device to my laptop USB port.

I lost track as I reset the damn Aqara gateway so many times trying to get it working. I had two issues.

  1. After resetting, I could not get the gateway to appear in the mi Home app even though it was actually connected to my network. This was DNS related and your DNS should ideally be 8.8.8.8 when joining the gateway to the app.

  2. My 2nd issue was lack of visibility to HA which turns out to be blocked port so after one of the resets, the ports got blocked and I didn’t realise.

A simply soft 5s soft network reset may not result in the problems I encountered?

N.B As a side note, my colours on my gateway light are now back to front after the reset. Red is Blue and vice versa so something went screwy.

1 Like

I rebuilt my Home Assistant server in an attempt to resolve some folder and file permission errors as well as cleaning up old code. I followed a different guide than the one I had used before. I could see the gateway, I could turn the light on and off, and my temperature and door sensors would read at startup, but then refuse to update.

The solution was my Docker-compose YAML file.
My old config had

homeassistant:
    container_name: homeassistant
    image: homeassistant/home-assistant
    network_mode: "host"

but the new config omitted "network_mode: “host”

Once I added that back in and ran my docker-compose up -d command, all is working.