Cannot connect Xiaomi Mijia Hub

Hello,

I cannot connect from HA to my Xiaomi Gateway at all. I have the latest Hass.io on RPI 3B+ (installed yesterday), the Hub has the latest FW installed. From MiHome app I can connect without any issues.

I tried almost everything I found on this forum to resolve this issue. However, without any success, the Hub does not communicate with HA.

This is how my log looks like:

2019-07-15 22:59:44 DEBUG (SyncWorker_6) [homeassistant.components.xiaomi_aqara] Expecting 1 gateways
2019-07-15 22:59:44 INFO (SyncWorker_6) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 1)
2019-07-15 22:59:49 INFO (SyncWorker_6) [xiaomi_gateway] Gateway discovery finished in 5 seconds
2019-07-15 22:59:49 INFO (SyncWorker_6) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 2)
2019-07-15 22:59:53 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi_aqara is taking over 10 seconds.
2019-07-15 22:59:54 INFO (SyncWorker_6) [xiaomi_gateway] Gateway discovery finished in 5 seconds
2019-07-15 22:59:54 INFO (SyncWorker_6) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 3)
2019-07-15 22:59:59 INFO (SyncWorker_6) [xiaomi_gateway] Gateway discovery finished in 5 seconds
2019-07-15 22:59:59 INFO (SyncWorker_6) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 4)
2019-07-15 23:00:04 INFO (SyncWorker_6) [xiaomi_gateway] Gateway discovery finished in 5 seconds
2019-07-15 23:00:04 INFO (SyncWorker_6) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 5)
2019-07-15 23:00:09 INFO (SyncWorker_6) [xiaomi_gateway] Gateway discovery finished in 5 seconds
2019-07-15 23:00:09 ERROR (SyncWorker_6) [homeassistant.components.xiaomi_aqara] No gateway discovered
2019-07-15 23:00:09 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi_aqara: Component failed to initialize.

And sample config:

xiaomi_aqara:
  discovery_retry: 5
  gateways:
    - key: yush2gk3e07gdme2

I tried lot of combinations of config values, empty mac causes a validation error for me.

I also tried nmap (from Windows):

Starting Nmap 7.70 ( https://nmap.org ) at 2019-07-15 23:32 Central Europe Daylight Time
Nmap scan report for 192.168.0.234
Host is up (0.082s latency).

PORT     STATE  SERVICE
4321/udp closed rwhois
9898/udp closed monkeycom
MAC Address: 78:11:DC:FB:2E:95 (Xiaomi Electronics,co.)

Nmap done: 1 IP address (1 host up) scanned in 24.66 seconds

So it appears the Hub cannot communicate on these ports. Again, tried to disable and re-enable wireless protocol in app for a few times.

Does this mean that this particular piece of Xiaomi Hub does not work with HA at all? I have read somewhere that some series, defined by MAC prefix, do not work. The only possibility there is to hack them by disassembling and soldering wires to UART and re-config it in a little ugly way. I hoped the Hub will work more or less out of the box.

if the ports are closed then either the LAN access is not correctly activated, or this is one of the hubs which is locked.

Either way, with the ports closed there is nothing for HA to talk to.

lots of info at https://github.com/home-assistant/home-assistant/issues/16407 but basic gist is open the ports/enable developer mode first before any firmware upgrade.