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

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?”

No.
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:

Thanks

In my house the coverage of the Xiaomi gateway/hub is better comparing to a cc2531 with zigbee2mqtt. That’s no surprise as the Xiaomi is a bigger box with probably a much better antenna inside then the tiny pcb antenna on the cc2531. But it should be no problem if there are mains connected zigbee devices that can act as zigbee router and/or you use cc2531 devices as routers as explained before.

The count of devices is of which devices connect to the concentrator or to the router. When you have around 16 devices (newer zigbee2mqtt image than mine limits to 20, see below) connected to the concentrator it probably will search for a router in the zigbee mesh network. With concentrator and routers the total would be 50 as this has something to do with connections tables and available memory space in the cc2531 as is mentioned in discussion threads in the zigbee2mqtt git pages.
See also here:

Network size
The CC2531 USB sniffer coordinator firmware has a limit of 20 direct children. This means 1 coordinator + 20 end devices and 0 routers.

However by adding routers to your network you can overcome the limit of 20 devices. This means that, e.g. a network of 1 coordinator, 4 routers and 50 end devices is possible.

The number of childs that a router support differs per device! Therefore, the increased size of a network by adding a router is arbitrary.

1 Like

Thanks again for giving me more detail. I hope a single router will work ok in my small flat. But the PCB antenna limitation is understood. I’ve seen some comments about people using a combination of two different boards ( CC2530 + CC2591 I think) one as a router and the other as the coordinator which comes with an externally attached antenna, but for now, I’m not concerned too much. The gateway annoyed me again today, after HASS restarted it couldn’t connect until I power cycled it.

I had that problem with old router (ISP one), since I installed Edge Router, and set static IP for gateway, I had zero problems.

Glad to help, no problem.
A cc2531 should be fine in a small flat. The combination of cc2530 + cc2591 is of a coordinator and an signal enhancer. The explanation of the cc2591 is: “Power Amplifier (PA) for higher output power and a Low Noise Amplifier (LNA) for improved receiver sensitivity.” See link.
One more tip/advice: I use an 1 mtr USB cable between the Pi and the cc2531 because Wifi, Zigbee (and also Bluetooth) use the same radiofrequency (2.4 Ghz) and can interfere. It works better in my experience and is a tiny investment. Good luck!

Great, will definitely use a usb extension from the usb hub because the rpi is located in a very corner area near lots of computer equipment which might interfere. I will raise the board and put it next to my RF Link legacy arduino receiver (behind a shelf) :slight_smile:

Anything new?
Sadly I’ve upgraded before finding this thread :frowning:

It feels like xiaomi switched the gateway to miio with version 161.

PORT      STATE         SERVICE
4321/udp  closed        rwhois
9898/udp  closed        monkeycom
54321/udp open|filtered bo2k

Looks like the mi home app for iOS won’t let you use it unless you update the firmware.

So I can’t add any new devices until we have a solution here :frowning:

You can follow this instruction.

Or this one.

1 Like

I also ran into this and decided to update the firmware. After doing so, I kept getting an error ‘unable to obtain’ when trying to generate a key. I restarted the hub and then it worked. Everything seems to be working again.

Hi guys. I see I’m not alone. I bought the gayeway few days ago and updated it to latest firmware even before I activated lan access. So now I can’t connect it to hass because enabling of wireless communication protocol has no effect. Ports 9898 and 4123 stay closed no matter I do. I tried enable\disable and key regeneration a lot of times but no luck. It looks like we will have to wait for the next firmware update where xiaomi hopefully fix the issue…