Xiaomi Gateway no Longer connecting on latest firmware - "Invalid Config"

Tags: #<Tag:0x00007f20477d7878>


I just read your other thread. Is that using the latest (updated) firmware that has caused the issues as first stated in this thread?


In the other thread he says 1.143_161 - although that is not a version I have seen discussed anywhere.

The first post of this thread refers to 1.4.1_161.0143. This is the version reported in other places too as being problematic.

@Pisupati could you please clarify?


Nickrout, you are correct 1.4.1_161.0143 is the firmware version of the hub. I had the version number wrong on my post, thank you, i will update it.


Cheers, 1.4.1_161.0143 is the version mine is asking me to upgrade to.


If your environment is okay, I would suggest not upgrading the xiaomi. This was my first time setting up the xiaomi and I selected the option to upgrade while setting it up in the app.


Trouble is, I have a version that doesn’t support the cube. I need to upgrade, but in doing so I will go to this apparently troublesome version. Kinda rock, meet hard place.


Good luck dude!


I see the cube works, and with more actions, in zigbee2mqtt, so I may do that rather than risk stuffing up my gateway.


It working fine for me, and I am not using auto discovery though. I have all my stuff static DHCP.

Could this be issues with firewall? I mean you could try put reject instead of block for firewall rules and allow to get dns request(from local dns resolver). As xiaomi vacuum won’t work if you have firewall set to block internet access, but if you set to reject it works.


Hey all,
It took a few tries but following @Pisupati’s instructions, removing everything from the Mi app, resetting it up, regenerating the code and turning off and on lan functions a few times, as well as using the key, mac address, and static IP setup in the HASS config, it now appears to be working again. Fingers crossed it stays that way!


I just got my gateway in the mail yesterday. After setting it up it prompted me to install the latest firmware, which I did. When I finally got to the step to enable LAN access, every time I flip the option on, I test if ports 9898 and 4321 have opened using nmap and they consistently stay closed, rendering the integration impossible. This sucks. Can’t seem to get those dang ports opened.


Stupid me, I had set up auto update in the Mi Home app and the hub updated to version 1.4.1_161.0143. It worked for over a year without much problems but now it behaves very bad and unreliable. I have to restart it quite often and more and more sensors loose connection to the hub and are not usable in HA, and it also gives very frequent (sometimes every few minutes and then a few hours without, etc) the following errors in HA:

No data in response from hub None
7:21 PM components/switch/xiaomi_aqara.py (ERROR)

Cannot connect to Gateway
7:21 PM components/switch/xiaomi_aqara.py (ERROR)

Cannot find a way to go back to a former firmware and so have to wait for Xiaomi/Aqara. Bummer! Perhaps a complete re-setup with all the devices would help but I’m too fed up with the Hub thing.

I had the intention to quietly move over to zigbee2mqtt (did a few things already) but now I feel forced to rush over to zigbee2mqtt (this still has some range problems but can be solved with zigbee routers). So I’m working on that.

It’s said before and I support it : don’t update to the newer firmware, better wait a few weeks to see if it’s ok, because there is no way back to a former firmware version!


There seem to be 2 versions of the hub, one with round text on the back which has issues after upgrade and an older version without round text that continues to work fine.

See pictures in this post


I’m on version 159 and my gateway is causing so many issues recently. Everything was working fine for a few months until suddenly it decided to start having trouble connecting to WiFi, ping timeouts, not responding to commands to control the light from HASS. All of this happened randomly, I was on the ‘no firmware upgrades’ policy as long as it works, it started behaving suspiciously and I upgraded it and I’m still having issues.
I think the next step is to factory reset it or upgrade to 161. I’m not sure about either approach. I’ve got loads of sensors.


Same experiences, but I thought the problems came from the upgrade. Perhaps it’s something else. Anyway, due to the problems and difficulties in finding solutions and information, I migrated to zigbee2mqtt and are happy with it. All the sensors and switches (~20) are moved. In zigbee2mqtt there are still a few things to be wished for but overall I’m very happy with the solution and hope it will develop further.


Sounds good, I’ve looked up zigbee2mqtt and I decided that I’m going to follow the same path. I just need the temp/door/window/motion sensors to work, don’t care if it’s via the gateway or some other alternative (perhaps it’s better not to have a Chinese device in the network). I’ll just plug the zigbee stick into my Raspberry Pi.
Can you elaborate a bit more on the ‘things to wish for’ just so I can see if those would be ‘show stoppers’ for the migration?


There are many great things to say about zigbee2mqtt, see the thread on this platform and the zigbee2mqtt website, just renewed. Big respect for Koenkk work, and I love the product.
Still, my tiny personal list of things to be wished:

  • More zigbee devices to be connected to the (zigbee2mqtt) cc2531 (max 16 is a small number). Solution is to add more zigbee routers which extend the number of devices, but more devices on the zigbee concentrator would also be nice. It is in development AFAIK.
  • Better area coverage aka better antenna for the cc2531. I know that you can use other devices but the cc2531 is such a handy device with the usb port. Solution is like above; to add more zigbee routers (I have 4 at the moment; 2 xiaomi power plugs and 2 cc2531 flashed as router. Most mains connected zigbee devices (can) act as zigbee mesh router.
  • Better and easier pairing. Sometimes it takes more than one try (many tries) to have the device paired to the zigbee2mqtt concentrator. It takes less time with less hassles to pair xiaomi devices to the xiaomi gateway/hub. Pairing is hopefully a one time job, so not a big deal. Also you can’t pair through routers.
  • Better network map. You can generate a map (see “networkmap”) but it’s not working right. To know how zigbee devices are connected in a mesh network would be nice, but it is not essential for functioning (and low on Koen’s prio’s list).

All in all the product is ready to be used and the limitations can be handled as described above.
It’s not a product for your not-so-handy neighbour, but HA aficionados can handle it easily :grinning:


Thanks for your comment dojf.
Right now, I’m on 18 devices, I was pretty sure I’ve seen something about 40 devices being supported per module. I ordered the cc2531 and related flasher anyway, hopefully I’ll be able to get somewhere with it. I don’t plan to have more than 30 devices so if they manage to lift the limit in software, that will be great. Otherwise, I might have to run two of those.

I believe concentrator = cc2531, router = RPI with the zigbee2mqtt software?

Just asking since you mentioned

can you explain this a bit more? Do you have to press something on the cc2531 to start pairing?

Apologies, I’m very new to this project but having really bad experience with GearBest support, I have no choice but to migrate to this.


Yes, I also saw some mentioning of versions with upper limit around 40 devices, but I rather stick with Koenkk version. And can easily be solved with cheap cc2531 with zigbee router software or other mains connected devices with zigbee routing function.

“I believe concentrator = cc2531, router = RPI with the zigbee2mqtt software?”

The zigbee2mqtt software (= concentrator) is flashed to a cc2531 and then connected to your HA Pi.

The zigbee router software can be found here and must also be flashed with the same programmer to a cc2531. And when ready you can stick the 2531 to a small usb 5V adapter (draws 50mA) and put it somewhere handy in a mains socket. See the instructions

Devices need to be paired to the concentrator (so nearby your HA Pi with the zigbee2mqtt concentrator) and when pairing is ready they can be placed wherever needed and find their way through the zigbee mesh network.

Read the zigbee2mqtt website thoroughly.

The cc2531 's can be found e.g. here .

Good luck!


That makes sense now!

Considering I’ve ordered a single cc2531 from eBay, I will just use one concentrator and no router. I’ve had no coverage issues with a single xiaomi gateway so I hope this will work without the need of a router.
I actually wasn’t aware zigbee can work in a mesh, thought it was a zwave feature.
Just one more quick question, when you add more routers, how does that allow more zigbee devices? The end devices just end up taking a ‘slot’ on the router?
Anyways, once the components arrive I’ll look into it. :slight_smile: