Not able to get Xiaomi Gateway Key

@Olivier974 Could you explain this? My understanding was that it WAS required to setup the hub in the MiHome App before setting up the integration in HA.

Yes, that exactly what i said : “ANY VERSION WILL WORK in HA without setting up before in MI HOME APP”.

In other words, whithout Mi Home App first setup, it can NOT work in HA.

Ok, i think what you meant to say is:

NO VERSION WILL WORK in HA without first setting it up in the MI HOME APP”.

Hi Olivier,

I have the Chinese version, the reason I know is because it came with a plug and all the text on the box is Chinese.

Still I do not understand how to add it to home-assisant without having the config set up.

I also have the version ZHWG11LM and it looks like it is the V1 version. HASS.io is saying it can be used without any problems but how ?

I see your post that you have 2 V1 gateways how did you got it working ? Or do I need to open a port in my router ? thanks in advance

As you can see I need a key for this hub and if i go here:

hass

I only see my 2 hue hubs and not the xiaomi and from your post:

So, if you dont have this version, IT DOESNT WORK with the method above with xxx-xx-xxx key in integration. !!!ONLY FOR CHINESE VERSION “HOME KIT COMPATIBLE”!!! NOT EU

I have this version so it should work with the key xxx-xx-xxx

Hi,

have you first configured the gateway in Mi Home APP?

Then unplug/plug back, wait 2 minutes, check if its ok in the Mi Home APP?

Then in HA : “discovery:” in config.Yaml, then restart HA.

If there is not a new device “discovered”, then go to integration page, +, then HomeKit, then you will be prompt to enter your key xxx-xx-xxx. Then you have the gateway.

If the Homekit integration doesnt find the gateway, that means something wrong in the wifi configuration… : try to put a static IP adress in your router, because that can be the problem!

You cant put a static adress in MI Home App but you can force the router to give always the same adress.

If you dont have the same static adress, it will be a messed up in HA…

In the begining i havent put a static adress in my router and sometimes he hive the gateway a new one and HA put a lot of errors…

Hi Olivier,

Thanks for replying me back. It is in the home mi app and it is stable. I also did the unplug/plug trick and also not works.

Hass and the hub are on the same wifi network but I will try the static IP address.

But for the config file I only need to put the discovery: in it ?

youre welcome!

HA is on a Wifi network? not an Ethernet one?

Yes, only :

discovery:

:wink:

Hi Olivier,

Static Ip address is on and I deleted the device and reconfigure and I see this now in hass:

Almost there but I do not know where it is connected to it.

Yes almost there!

I already have this message…have a look at your configuration file, be sure to remove anything about

xiaomi_aqara:

and complete reboot HA (not a “restart server”)

Nice thing is your gateway is well recognize (Aqara Hub-5079).

If it doesnt work, unpair from Mi Home APP and restart HA, then do all again : Mi Home App config, then restart HA with

discovery:

enable.

Hi Olivier,

Still no success and I also removed all my

xiaomi_aqara:

But hass is still giving me errors about a invalid config, I can also see the hub when I connect to it with the mi home app (it is needed to set it up)

Also here:

image

but I have nothing left in the config file that is mentioning anything about that hub

And in the log I see this:

2020-04-26 14:42:06 ERROR (SyncWorker_13) [homeassistant.components.xiaomi_aqara] No gateway discovered 2020-04-26 14:42:06 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi_aqara: Integration failed to initialize.

I don’t know what I’m doing wrong

there still something in your configuration that call

xiaomi_aqara:

because with

discovery:

you are normally just prompt to enter the key xxx-xx-xxx for the new device discovered…

so…i think, you have to take a snapshot for the moment before you add “xiaomi_aqara:” in your config (hope you make a snapshot)

or…restart from sratch…and wipe and restor a snapshot before the “xiaomi_aqara:” in configuration.yaml, who was not the good way for your gateway to make it work…

Hi Olivier,

I got success, the issue was that it was connected to an other device. In my case it was homekit “home” that was set up on an Iphone.

I did all the time with an Iphone (don’t ask me why :slight_smile: ) but I managed to delete the “home” and I tried once more set it up on my android device.

This time it linked to my phone and hass was able to discover the device and I could use the code that was provided on the box in the format xxx-xx-xxx

So for the people:

  1. use a fixed IP
  2. make sure it is not connected to an other apple smart aplication, it needs to be connected only to the mi home app
  3. make sure discovery: is in your config file
  4. restart hass and it should be able to discover yoyr hub
  5. if you have a V1 use the code in format xxx-xx-xxx

Update:

after a reboot it also includes the sensors attached to this hub :slight_smile:

BTW how fast are the sensor regarding state transitions ?

Thanks alot

2 Likes

Great! happy for you!

Usually states are update between 2 and 10 secondes…but it depends on your hassio installation and the system that are running hassio/HA : a raspberry4 is faster than a 3 but a PC or NUC can be more faster than a raspberry…so its difficult to apply a rule…

For my experience, when my Rpi4 4Gb is Idle, its 5-6% of CPU use and the states are update at the average of 2-3 seconds…

Hi Olivier,

It is not 100% stable yet, on andoid mi home is very unstable, which version are you using ?

Yes same, my Android version is 5.6.79,

but i dont use Mi Home at all…just to upgrade the gateways…

My 2 Aqara hub are plugin version 1.0.64, have you upgrade to the latest firmware your gateway in Mi Home APP?

At the beginning i was afraid to upgrade the firmware but it seems to be more and more stable with latest…so you can try without fear, i have the latest installed :wink:
the last one is 1.6.8_003 for the ZHWG11LM

Thnx,

I’m trying to install a older APK version, but I think the main issue is resolved :slight_smile: thanks alot Olivier you helped me alot

1 Like

can i get ssh without Solder

I don’t think so :frowning:

hello there, here I get an “No unpaired device” error message?

hello,

that mean the gateway is already paired with HA…

Be sure its not in HA, if you dont know what do do, try with a fresh install of ha.

First pair with your phone and Mi Home. Then with HA (its explained in my previous POSTSSSSSS above).

Good luck!

PS : there is a new integration in HA 0.111 : the discovery is automatic in notification you will normally have :

Xiaomi Gateway