Not able to get Xiaomi Gateway Key

You’re very kind. Your answer is very complete and has helped me a lot.

1 Like

You’re welcome!

i just take time for the community :wink:

Hi all,
@Olivier974 are you able to help “un frenchy” please :slight_smile:

my settings :
I ordered on amazon a Mi Smart sensor Set model : ZHTZ02LM
The gateway is Mi Control Hub model : DGNWG05LM (Euro device)
Version of Mi Home App : 5.6.65

I tried several tricks but I’m still close to Zero.

It’s impossible in the App to set China location. The App seems to use location or device model. I also try to fake my location but nothing works.

I Have My gateway IP and MAC

Any idea for find the key ?

Hello @FloSyno,

sorry i speak english because it can helps others…(google translation is your friend :slight_smile:).

Sorry again but LOL : if you have a European version, you can only select location from…Europe…

So, its normal you cant connect to China server.

And yes the Mi Home App use the location, but at my experience, even if i am living in Réunion Island (French Territory), i only use Chinese Xiaomi gateways (i have 5) and i only use China Mainland in APP, and it works, even if i am not living in China.

So I think you have to select an european country in the app for your gateway works.

After you are connected and you have your gateway configured in the Mi Home APP,
just look at my last post, and all is explained.

A+

Thanks @Olivier974 for your quick answer. I well connect with Mi home APP, my problem is that I don’t have the “About” or “à propos” button in european version :frowning:

the key is mandatory to use the following code :

xiaomi_aqara:
discovery_retry: 5
gateways:
- key: xxxxxxxxxxxxxxxx

Any other way to obtain this key ?

You havent read my last post, isnt it?

Open you Mi Home APP, clic on your gateway picture listed in Mi Home APP, give here the screenshot of you app (first page that open after clic on the gateway) :

If you have the first one, Aqara Hub, WITHOUT the mention “HomeKit compatible”, this gateway doesnt work with HomeAssistant.

a quick search and i think the EU version doesnt work with HA : [https://community.home-assistant.io/t/xiaomi-aqara-confusion/80365/72?u=olivier974](Not able to get Xiaomi Gateway Key - #124 by Olivier974) :

" krash

Jan 9

Same here, got the EU version DGNWG05LM yesterday.
It even has an EU distinguisher on its SSID when in AP mode.

  • The mi app was unable to discover it.
  • I tried sharing it to a second, chineese mi account, didnt work.
  • I even tried manual AP pairing, it wouldnt connect to the SSID with EU words in it.
  • Tried creating a wifi-ssid named exactly how the app wanted it, bypass the step that checks for ssid and then switching to the AP of the gateway and try to flash with no luck.
  • My HA detects a gateway but gives me a notification error like this:
The following components and platforms could not be set up:

* [xiaomi-aqara](https://home-assistant.io/integrations/xiaomi_aqara/)

Please check your config.

Is there any team working on a way to easily implement the EU version anytime soon?
Has anyone tried the soldering workaround to the EU version? although after reading this , i still dont understand how to get the code after sending the commands to open the port.
Or should i see if it’s possible to return it?

  • Alternatively, i found a shop near me that sells a chinese set with the **DGNWG02LM ** can anyone confirm if that will work with HA (and the rest of the parts from the DGNWG05LM set?

I dont have the time luxury right now to get into the zigbee2mqtt game"

You better buy a chinese version, read my post, the last version “Mijia Gateway 2019” work with HA in 5 minutes , because its “homeKit compatible”.

Enjoy

Hi,
I also bought the DGNWG05LM eu version as I already having 2 x Roborock s5 vacuum cleaners bought in Denmark, and they are “locked” to eu server.

I have tried everything, and after a lot of research and troubleshooting, I managed to get the Token Key… but as we cannot access the developer settings, the ports are closed, and we will not be able to get it to work.
I hope they will so something and add the options for non Chinise users…

I also read an article that they have managed to get it to work, opening the device and use some wires - but that I don’t want to do…

I gave up trying to work with the EU version, I gifted it to a friend who just wanted xiaomi functionality.
On the other hand, i got my hands on two Chinese gateways and they both worked fine. Didn’t update their firmware though.

Hello @krash,

yes, you can update the firware without any problem :wink:

Good news,
Could you tell me specifically which firmware you are on and it works?

1 Like

sure!

1.6.8_003 for the ZHWG11LM

1.4.1_175 for the DGNWG02LM

@Olivier974 I just received the aqara gateways (and resent MI one)

The 8 digits are wrote on the box, the datasheet and on the gateway Awesome.

Home Assistant setup is really easy now :wink:

One more question when I want to write in my yaml code the key on 8 digits I have a warning message of my code control. Home assistant want only 16 digits code :frowning:

I tried to scan and read the QR code but 13digits code appear with “X-HM://” before

Any idea on how to convert 8 digits on 16 ?

hello @Flo,

just enter the key with the “-” (minus) like : xxx-xx-xxx

it works with this style only, 10 digits.

I works with integration add HomeKit Accessory is perfect with XXX-XX-XXX :ok_hand:

my problem appear in the code like when I want to hard code that :

xiaomi_aqara:
discovery_retry: 5
gateways:
- mac: XX:XX:XX:XX:XX:XX # MAC AQARA
key: 103-35-287 aqara key

I have a error saying :

Invalid config for [xiaomi_aqara]: length of value must be at least 16 for dictionary value @ data[‘xiaomi_aqara’][‘gateways’][0][‘key’]. Got ‘103-35-287’. (See /config/c

compilator is not really compliant :frowning:

Thanks a lot a lot a lot a lot for Olivier!
I have the Mijia gateway 2019
And thanks to your explanation it was very easy to install in Home Assistant:
I have unplugged and plugged the gateway from the power supply.
Then HA has discovered the new device
The “token” is writen under the gateway and in the manual for me. It was 8 digits to put simply in the form xxx-xx-xxx
Very Easy!
Thaaaaaaannnnnkkksssss !!!

1 Like

read step by step my post…you do wrong…the key in

xiaomi_aqara:

is not format like xxx-xx-xxx…, this is just for Aqara gateway, one time is recognize by HA, done.

The other config in configuration.yaml

xiaomi_aqara:

is for Mio gateways (not Aqara one, compatible HomeKit with key provide on the box xxx-xx-xxx).

You seems to have some problems to read a post step by step… @benooye has read and understand so i dont think my post is malformed or difficult to understand…

happy for you!

Check this:

Salut, celui ci est bon pour moi ? Il est compatible avec HA ?
Merci beaucoup Olivier.