Help getting Xiaomi Gateway to work with HA

Yes its updated and current firmware is 1.4.1_150.0143

This may of been covered but will reiterate - since it got me quite good 0 make sure you enable/switch on “network wireless protocol” in the app when you go through the “about” and get the key. There isn’t much in the way of troubleshooting from the logs, the component will just throw a worthless “invalid config” error.

You will find the entity_registry.yaml file and delete all that has to do with xiaomi_aqara. After that you will restart the system and you should see the information about - getway

FYI - for reference these devices need to have multicast, as many others have stated. What this means is that there are a couple of requirements …
First, multicast is non-routable, so your xiaomi and home assistant must be on the same network. I made the mistake of trying to put my xiaomi on my “iot” network and the result I got is similar to the OP in that I could send commands to the gateway but could not receive any status from the gateway or get any buttons to work.

Secondly, if your router does not support multicast, you probably will need or should get a new router but if you are happy with the router’s performance, you should first check out DDWRT to see if it is supported for your router. This could save you some money if budget is a concern…

After moving my gateway to the same network as my hassio, I was able to simply add the config as follows:

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - mac:
      key: !secret xkey

It now works great! Next step is to disable all phone homes to China and re-test…will re-post details soon.

Found a solution?

Hi all

I have just bought a gateway because I saw that you were able to configure in Ha

Unfortunately I cannot find in the mi app any wherei to locate the token

Done some research and have downloaded earlier versions of mi home as these versions apparently. Could retrieve the key. Still no key/ token

Ha finds the Xiaomi device and tells me to configure it but alas I am still missing the key / token

And help is most appreciated

Paul