Can't configure Xiaomi gateway

Hi
I have Xiaomi gateway (lumi.gateway.v3, F.W=1.4.1_164.0158), I tried all the settings options and all the other topics here but without any success.

my configuration :

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - mac: 7c49eb88cb1b
      host: 192.168.1.65
      key: ltd*********

and here is the log:

2019-02-01 09:56:27 DEBUG (SyncWorker_8) [homeassistant.components.xiaomi_aqara] Expecting 1 gateways
2019-02-01 09:56:27 INFO (SyncWorker_8) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 1)
2019-02-01 09:56:27 INFO (SyncWorker_8) [xiaomi_gateway] Xiaomi Gateway 7c49eb88cb1b configured at IP 192.168.1.65:9898
2019-02-01 09:56:27 DEBUG (SyncWorker_8) [xiaomi_gateway] _send_cmd >> b’{“cmd”:“read”,“sid”:“7c49eb88cb1b”}’
2019-02-01 09:56:36 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi_aqara is taking over 10 seconds.
2019-02-01 09:56:37 ERROR (SyncWorker_8) [xiaomi_gateway] Cannot connect to Gateway
2019-02-01 09:56:37 ERROR (SyncWorker_8) [xiaomi_gateway] No data in response from hub None
2019-02-01 09:56:37 INFO (SyncWorker_8) [xiaomi_gateway] Discovering Xiaomi Devices
2019-02-01 09:56:37 DEBUG (SyncWorker_8) [xiaomi_gateway] _send_cmd >> b’{“cmd” : “get_id_list”}’
2019-02-01 09:56:47 ERROR (SyncWorker_8) [xiaomi_gateway] Cannot connect to Gateway
2019-02-01 09:56:47 INFO (SyncWorker_8) [xiaomi_gateway] Discovering Xiaomi Devices
2019-02-01 09:56:47 DEBUG (SyncWorker_8) [xiaomi_gateway] _send_cmd >> b’{“cmd” : “get_id_list”}’
2019-02-01 09:56:57 ERROR (SyncWorker_8) [xiaomi_gateway] Cannot connect to Gateway
2019-02-01 09:56:57 INFO (SyncWorker_8) [xiaomi_gateway] Discovering Xiaomi Devices
2019-02-01 09:56:57 DEBUG (SyncWorker_8) [xiaomi_gateway] _send_cmd >> b’{“cmd” : “get_id_list”}’
2019-02-01 09:57:07 ERROR (SyncWorker_8) [xiaomi_gateway] Cannot connect to Gateway
2019-02-01 09:57:07 INFO (SyncWorker_8) [xiaomi_gateway] Discovering Xiaomi Devices
2019-02-01 09:57:07 DEBUG (SyncWorker_8) [xiaomi_gateway] _send_cmd >> b’{“cmd” : “get_id_list”}’
2019-02-01 09:57:17 ERROR (SyncWorker_8) [xiaomi_gateway] Cannot connect to Gateway
2019-02-01 09:57:17 INFO (SyncWorker_8) [xiaomi_gateway] Discovering Xiaomi Devices
2019-02-01 09:57:17 DEBUG (SyncWorker_8) [xiaomi_gateway] _send_cmd >> b’{“cmd” : “get_id_list”}’
2019-02-01 09:57:27 ERROR (SyncWorker_8) [xiaomi_gateway] Cannot connect to Gateway
2019-02-01 09:57:32 INFO (SyncWorker_8) [xiaomi_gateway] Gateway discovery finished in 5 seconds
2019-02-01 09:57:32 INFO (SyncWorker_8) [xiaomi_gateway] Creating Multicast Socket
2019-02-01 09:57:32 DEBUG (SyncWorker_8) [homeassistant.components.xiaomi_aqara] Gateways discovered. Listening for broadcasts

Thanks :slight_smile:

1 Like

Can you ping this IP?
What is your server’s IP? Is it RPi or Linux or what?
Looks like a network problem. Or you specified a wrong key. Try to regenerate it - it won’t hurt.

Hey and thank you for your reply ,
my server is hassio that run on RP,and I can get ping .
I will try to regenerate the key

i tried to change the key but i get the same error log…

any other suggestions?

Are you sure the gateway IP and Mac are correct? Is the gateway configured with a static IP? Perhaps you can remove the ‘host’ line and only rely on the mac config.

Can you check the screen where you generate the password in the mi home app and make sure the Lan control option is set to on?

The log seems to indicate a network problem or that the gateway is blocking external requests.

Did the gateway work before firmware update F.W=1.4.1_164.0158 ?

I had the same issue . I had to disassemble the gateway and connect a serial connection and issue the following command

psm-set network.open_pf 3

see

managed to make the connections without soldering . Need steady hands and the ability to type one handed :slight_smile:

3 Likes

it’s a new one, so I didn’t use it with the older firmware.

This is almost certainly your problem. Port 9898 is closed. From what I read before I ugraded, was if the hub was in developer mode before upgrading all should be OK. Not for me :slight_smile:

My logs were exactly the same as yours adding mac address and IP to the configuration yaml made no difference.

I used the following kit to solve the issue

An old screwdriver . You will need to file a notch in it to open the tamper proof screws

USB UART TTL 3.3V Converter/Programmer

https://www.amazon.co.uk/s/ref=nb_sb_noss_2?url=search-alias%3Daps&field-keywords=+USB+UART+TTL+3.3V+Converter%2FProgrammer

I used some breadboard pins to make the connections . I would recommend you solder the wires in place. Touching a live circuit board with it on is not recommended.

1 Like

I’m no expert, but I do know that this works with my config, so … give it a go :slight_smile:

No Mac, no IP

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - key: !secret xiaomi_key

Thank you :slight_smile:
no other simple solution?

The config you used is wrong. You have no indentation.

image

1 Like

Please see the instructions at the top of each forum page for how to post your code.

2 Likes

hi @orcool, try tu put MAC, KEY and HOST in this order, it solved me

Best

1 Like

Prove the port is closed. Try the following on the Hass.io ssh console

ping x.x.x.x (ip of gateway) to prove the Hub is on network

nmap -Su -v -p 9898 x.x.x.x if this port is closed that’s the problem !

Confirm the the Key and the wireless communication protocol are on. If they are unfortunately you need the fix

1 Like

Is this an Aqara Hub with Apple home-kit support ? If so I don’t think this hub is supported in HA . The above fix only work for v2 hubs see

I have this one:
https://www.gearbest.com/living-appliances/pp_344667.html?lkid=12972004

thank you all,
I will try your suggestions and I will update tomorrow

That model is fine. Same as mine, should work fine with HA