Cannot connect Xiaomi Gateway (lumi.gateway.v3) to HA

I’ve received Xiaomi Gateway (lumi.gateway.v3) and has been able to pair it with Mi Home App on Android, and also pair it with two motion sensors and one door sensor with no problem at all. However I still failed to add the gateway to my HA even after reading the docs and various threads here. Maybe it is related to my system setting, so I open this thread to ask for your help as I’m not an expert in Linux system. Here is the detail :

  1. HA installation : Hass.io in Ubuntu Server 18.04 running as guest in VMWare Workstation, which is running on top of Windows 10 desktop PC. The installation method is as described here. This system has been working wonderful for a month using various sonoff and broadlink devices.

  2. Networking : the guest Ubuntu in VM is bridged to the physical USB wireless adapter in the host PC, meaning the ubuntu/hassio is in the same subnet with the physical router and xiaomi gateway. In this case, hassio (192.168.0.143), router (192.168.0.1), and xiaomi (192.168.0.108). Each one can ping other successfully.

  3. Multicast support : I’m not sure on this. I have Tenda AC6 wireless router, which has support for multicast IPTV (which I’m not using). However, I’ve managed to setup a multicast test using ipref tool between hassio machine and another ubuntu VM machine which seems successful (in picture below).

  4. Xiaomi Gateway : using the latest Mi Home app available in my Play Store, choosing China Mainland as the server, and updating the gateway to the latest version available (ver 1.4.1_157.0143). I’ve enabled developer mode, toggling “wireless communication protocol” on, and noted the password. Hub info is shown in the picture below.

  5. The problem : At first, the xiaomi gateway were discovered automatically by discover: component. After adding essential detail just as decribed in the docs, HA seems cannot found the gateway (based on the debug log). The only way I can make it discover the gateway is using this code :

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - host: 192.168.0.108
      mac: 7811dcb37d98
      key: t2dt3h2gmq4ptfvs

now there’s no error in the frontend, however the gateway and sensors still not coming up, and resulted in the following log :

2018-08-26 20:19:07 WARNING (MainThread) [homeassistant.components.http] Experimental auth api enabled and legacy_api_password support enabled. Please use access_token instead api_password, although you can still use legacy api_password
2018-08-26 20:19:07 WARNING (MainThread) [homeassistant.loader] You are using a custom component for sensor.broadlink_power which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2018-08-26 20:19:08 DEBUG (SyncWorker_4) [homeassistant.components.xiaomi_aqara] Expecting 1 gateways
2018-08-26 20:19:08 INFO (SyncWorker_4) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 1)
2018-08-26 20:19:18 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi_aqara is taking over 10 seconds.
2018-08-26 20:19:18 ERROR (SyncWorker_4) [xiaomi_gateway] Cannot connect to Gateway
2018-08-26 20:19:18 ERROR (SyncWorker_4) [xiaomi_gateway] No data in response from hub None
2018-08-26 20:19:20 WARNING (SyncWorker_0) [homeassistant.components.light.flux_led] Failed to connect to bulb 192.168.0.180, LED Tempat Tidur
2018-08-26 20:19:28 ERROR (SyncWorker_4) [xiaomi_gateway] Cannot connect to Gateway
2018-08-26 20:19:38 ERROR (SyncWorker_4) [xiaomi_gateway] Cannot connect to Gateway
2018-08-26 20:19:48 ERROR (SyncWorker_4) [xiaomi_gateway] Cannot connect to Gateway
2018-08-26 20:19:58 ERROR (SyncWorker_4) [xiaomi_gateway] Cannot connect to Gateway
2018-08-26 20:20:08 ERROR (SyncWorker_4) [xiaomi_gateway] Cannot connect to Gateway
2018-08-26 20:20:13 DEBUG (SyncWorker_4) [homeassistant.components.xiaomi_aqara] Gateways discovered. Listening for broadcasts
2018-08-26 20:20:13 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.xiaomi_aqara
2018-08-26 20:20:27 WARNING (SyncWorker_4) [netdisco.ssdp] Error fetching description at http://10.72.89.20:60000/description.xml

now it seems HA found my xiaomi gateway but cannot proceed to communicate well? I tried to see whether the 9898 port blocked/closed on the xiaomi side. I proceed to check it as follow :

root@homeassistant:~# nmap -sU -p 9898 192.168.0.108

Starting Nmap 7.60 ( https://nmap.org ) at 2018-08-26 13:43 UTC
Nmap scan report for 192.168.0.108
Host is up (0.16s latency).

PORT     STATE  SERVICE
9898/udp closed monkeycom
MAC Address: 78:11:DC:B3:7D:98 (Xiaomi Electronics,co.)

Nmap done: 1 IP address (1 host up) scanned in 13.66 seconds
root@homeassistant:~# nmap -sU -p 9898 192.168.0.108

Starting Nmap 7.60 ( https://nmap.org ) at 2018-08-26 13:43 UTC
Nmap scan report for 192.168.0.108
Host is up (-0.060s latency).

PORT     STATE         SERVICE
9898/udp open|filtered monkeycom
MAC Address: 78:11:DC:B3:7D:98 (Xiaomi Electronics,co.)

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

Strange thing I guess. First test showed the port as closed, however second test showed it as open, although ‘filtered’. Is this the cause of my failure? How can I resolve this problem? I have tried :

  1. hard reset the gateway (5 second button push), deleting the devices and child devices from the mi-home app
  2. reboot the ubuntu VM
  3. reboot the host machine
  4. make sure windows firewall is off

Is there anything I can try to resolve my issue?

Did you try a minumum configuration without mac and host? If you specify the mac you need to use it like this 78:11:DC:B3:7D:98

Thanks for the suggestion @sjee , I’ve tried your first suggestion like this

xiaomi_aqara:
  discovery_retry: 10
  gateways:
#   - host: 192.168.0.108
#     mac: 78:11:DC:B3:7D:98
    - key: t2dt3h2gmq4ptfvs

it failed to discover any gateway on the network :

2018-08-26 21:47:01 WARNING (MainThread) [homeassistant.components.http] Experimental auth api enabled and legacy_api_password support enabled. Please use access_token instead api_password, although you can still use legacy api_password
2018-08-26 21:47:02 WARNING (MainThread) [homeassistant.loader] You are using a custom component for sensor.broadlink_power which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2018-08-26 21:47:03 DEBUG (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Expecting 1 gateways
2018-08-26 21:47:03 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 1)
2018-08-26 21:47:08 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 2)
2018-08-26 21:47:13 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi_aqara is taking over 10 seconds.
2018-08-26 21:47:13 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 3)
2018-08-26 21:47:14 WARNING (SyncWorker_0) [homeassistant.components.light.flux_led] Failed to connect to bulb 192.168.0.180, LED Tempat Tidur
2018-08-26 21:47:18 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 4)
2018-08-26 21:47:23 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 5)
2018-08-26 21:47:28 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 6)
2018-08-26 21:47:33 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 7)
2018-08-26 21:47:38 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 8)
2018-08-26 21:47:43 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 9)
2018-08-26 21:47:48 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 10)
2018-08-26 21:47:53 ERROR (SyncWorker_2) [homeassistant.components.xiaomi_aqara] No gateway discovered
2018-08-26 21:47:53 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi_aqara: Component failed to initialize.

If I try your second suggestion of formatting the MAC like this :

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - host: 192.168.0.108
      mac: 78:11:DC:B3:7D:98
      key: t2dt3h2gmq4ptfvs

still getting error like this :

2018-08-26 21:41:50 WARNING (MainThread) [homeassistant.components.http] Experimental auth api enabled and legacy_api_password support enabled. Please use access_token instead api_password, although you can still use legacy api_password
2018-08-26 21:41:51 WARNING (MainThread) [homeassistant.loader] You are using a custom component for sensor.broadlink_power which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2018-08-26 21:41:51 DEBUG (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Expecting 1 gateways
2018-08-26 21:41:51 INFO (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 1)
2018-08-26 21:42:01 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi_aqara is taking over 10 seconds.
2018-08-26 21:42:01 ERROR (SyncWorker_1) [xiaomi_gateway] Cannot connect to Gateway
2018-08-26 21:42:01 ERROR (SyncWorker_1) [xiaomi_gateway] No data in response from hub None
2018-08-26 21:42:03 WARNING (SyncWorker_2) [homeassistant.components.light.flux_led] Failed to connect to bulb 192.168.0.180, LED Tempat Tidur
2018-08-26 21:42:11 ERROR (SyncWorker_1) [xiaomi_gateway] Cannot connect to Gateway
2018-08-26 21:42:21 ERROR (SyncWorker_1) [xiaomi_gateway] Cannot connect to Gateway
2018-08-26 21:42:31 ERROR (SyncWorker_1) [xiaomi_gateway] Cannot connect to Gateway
2018-08-26 21:42:41 ERROR (SyncWorker_1) [xiaomi_gateway] Cannot connect to Gateway
2018-08-26 21:42:51 ERROR (SyncWorker_1) [xiaomi_gateway] Cannot connect to Gateway
2018-08-26 21:42:56 DEBUG (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Gateways discovered. Listening for broadcasts
2018-08-26 21:42:56 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.xiaomi_aqara
2018-08-26 21:43:02 ERROR (SyncWorker_2) [homeassistant.components.telegram_bot] Error sending message: Timed out. Args: (66291291, '*Home Assistant di rumah Jambon 19 sudah menyala!*'), kwargs: {'parse_mode': 'Markdown', 'disable_notification': False, 'disable_web_page_preview': None, 'reply_to_message_id': None, 'reply_markup': None, 'timeout': None}

It seems like something blocking the communication between the xiaomi gateway and HA machine, I just don’t know what…

This is the setup I have for mine,

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - mac: 78:11:df:b8:e8:ea
      key: 6B44B6B2EFD8430B

Every now and again on restart it doesn’t pick it up, but on a second restart it comes up fine, so maybe try it without the IP.

Thanks for the suggestion @Cee I have tried to setup your way, ie without ‘host’ and uppercase of key with colon in MAC, like this :

xiaomi_aqara:
# discovery_retry: 10
# interface: '192.168.0.143'
  gateways:
#   - host: 192.168.0.108
    - mac: 78:11:dc:b3:7d:98
      key: OQIDPERH9LPTAA6H

but using this setup HA cannot found my gateway.

2018-08-27 05:12:33 WARNING (MainThread) [homeassistant.components.http] Experimental auth api enabled and legacy_api_password support enabled. Please use access_token instead api_password, although you can still use legacy api_password
2018-08-27 05:12:34 WARNING (MainThread) [homeassistant.loader] You are using a custom component for sensor.broadlink_power which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2018-08-27 05:12:35 DEBUG (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Expecting 1 gateways
2018-08-27 05:12:35 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 1)
2018-08-27 05:12:40 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 2)
2018-08-27 05:12:45 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi_aqara is taking over 10 seconds.
2018-08-27 05:12:45 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 3)
2018-08-27 05:12:46 WARNING (SyncWorker_1) [homeassistant.components.light.flux_led] Failed to connect to bulb 192.168.0.180, LED Tempat Tidur
2018-08-27 05:12:50 ERROR (SyncWorker_2) [homeassistant.components.xiaomi_aqara] No gateway discovered
2018-08-27 05:12:50 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi_aqara: Component failed to initialize.

Every now and then I tried running nmap to check whether the port 9898 on the xiaomi gateway is open, and the result is strange, sometimes it is reported as closed, sometimes as open|filtered. Could you post your result while running nmap?

root@homeassistant:~# nmap -sU -p 9898 192.168.0.108

Starting Nmap 7.60 ( https://nmap.org ) at 2018-08-26 22:19 UTC
Nmap scan report for 192.168.0.108
Host is up (0.10s latency).

PORT     STATE  SERVICE
9898/udp closed monkeycom
MAC Address: 78:11:DC:B3:7D:98 (Xiaomi Electronics,co.)

Nmap done: 1 IP address (1 host up) scanned in 13.85 seconds
root@homeassistant:~# nmap -sU -p 9898 192.168.0.108

Starting Nmap 7.60 ( https://nmap.org ) at 2018-08-26 22:20 UTC
Nmap scan report for 192.168.0.108
Host is up (0.11s latency).

PORT     STATE  SERVICE
9898/udp closed monkeycom
MAC Address: 78:11:DC:B3:7D:98 (Xiaomi Electronics,co.)

Nmap done: 1 IP address (1 host up) scanned in 13.85 seconds
root@homeassistant:~# nmap -sU -p 9898 192.168.0.108

Starting Nmap 7.60 ( https://nmap.org ) at 2018-08-26 22:20 UTC
Nmap scan report for 192.168.0.108
Host is up (0.10s latency).

PORT     STATE  SERVICE
9898/udp closed monkeycom
MAC Address: 78:11:DC:B3:7D:98 (Xiaomi Electronics,co.)

Nmap done: 1 IP address (1 host up) scanned in 13.65 seconds
root@homeassistant:~# nmap -sU -p 9898 192.168.0.108

Starting Nmap 7.60 ( https://nmap.org ) at 2018-08-26 22:20 UTC
Nmap scan report for 192.168.0.108
Host is up (0.0092s latency).

PORT     STATE  SERVICE
9898/udp closed monkeycom
MAC Address: 78:11:DC:B3:7D:98 (Xiaomi Electronics,co.)

Nmap done: 1 IP address (1 host up) scanned in 13.45 seconds
root@homeassistant:~# nmap -sU -p 9898 192.168.0.108

Starting Nmap 7.60 ( https://nmap.org ) at 2018-08-26 22:21 UTC
Nmap scan report for 192.168.0.108
Host is up (0.095s latency).

PORT     STATE  SERVICE
9898/udp closed monkeycom
MAC Address: 78:11:DC:B3:7D:98 (Xiaomi Electronics,co.)

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

Exactly the same, sometimes open, sometimes closed, sometimes filtered as well, seem’s that is normal behaviour for it. I do have mine on a blocked LAN, but that should make no difference at all.

Have you been through ALL of these steps?

@Cee I never see the port to be ‘fully’ open, at most it’s just open|filtered and most of the time it’s just closed…

@nickrout yes I’ve tried to follow all the steps in troubleshooting. I have :

  1. enabled LAN access

  2. turn off firewall on my windows 10 (host) and ubuntu (guest in VM)
    fw-win

root@homeassistant:~# ufw status
Status: inactive
  1. multicast support on router. I’m not sure on this, I have Tenda AC6. I’ve tried searching in the manual, and the only place I found about multicast is in the IPTV setting. I’m not using the IPTV feature but I have enabled it, just in case. I’ve read here about using iperf to test multicast capability of my network. I don’t know whether this is the right tool and whether the result is valid, however I get good result using this method. I’ve already sent an email to Tenda support regarding this regard and still awaiting their response.
    multicast

  2. trying to set mac: blank → no effect, still error.

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - host: 192.168.0.108
      mac: 
      key: oqidperh9lptaa6h

result in following debug log :

2018-08-27 10:10:46 WARNING (MainThread) [homeassistant.components.http] Experimental auth api enabled and legacy_api_password support enabled. Please use access_token instead api_password, although you can still use legacy api_password
2018-08-27 10:10:46 WARNING (MainThread) [homeassistant.loader] You are using a custom component for sensor.broadlink_power which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2018-08-27 10:10:47 DEBUG (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Expecting 1 gateways
2018-08-27 10:10:47 INFO (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 1)
2018-08-27 10:10:52 INFO (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 2)
2018-08-27 10:10:57 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi_aqara is taking over 10 seconds.
2018-08-27 10:10:57 INFO (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 3)
2018-08-27 10:10:59 WARNING (SyncWorker_4) [homeassistant.components.light.flux_led] Failed to connect to bulb 192.168.0.180, LED Tempat Tidur
2018-08-27 10:11:02 INFO (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 4)
2018-08-27 10:11:07 INFO (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 5)
2018-08-27 10:11:12 INFO (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 6)
2018-08-27 10:11:17 INFO (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 7)
2018-08-27 10:11:22 INFO (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 8)
2018-08-27 10:11:27 INFO (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 9)
2018-08-27 10:11:32 INFO (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 10)
2018-08-27 10:11:37 ERROR (SyncWorker_1) [homeassistant.components.xiaomi_aqara] No gateway discovered
2018-08-27 10:11:37 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi_aqara: Component failed to initialize.
  1. set discovery_retry: 10 → no effect also. If I don’t put host: and mac: specifically, the auto-discovery will fail even after 10 retries. I have to specifically put the IP address and mac of the xiaomi gateway for it to be found.

  2. disable-enable Lan access from miHome apps has no effect also.

  3. hard-reset gateway → I’ve tried several times but still same errors

  4. docker… I think I don’t use docker. I’ve installed hassio directly to the Ubuntu VM. CMIIW…

  5. I never get error about invalid key…

  6. I have no error about PyXiaomiGateway library… However I went ahead and install all dependencies

root@homeassistant:~# apt-get install python3-dev libssl-dev libffi-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
libffi-dev is already the newest version (3.2.1-8).
libssl-dev is already the newest version (1.1.0g-2ubuntu4.1).
python3-dev is already the newest version (3.6.5-3ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

In short, I have tried every toubleshooting steps in the documentation page, but still unsuccessful. I have some suspicion :

  1. My errorr always stopped at listening for broadcast. Could it be my router doesn’t support multicast?
  2. I may have too complicated network hops : xiaomi gateway ↔ wireless router (Tenda AC6) ↔ wireless USB stick (TP-Link TL-WN722N) ↔ VMware Ubuntu host (bridged).

I will try to run hassio from persistent-storage live ubuntu on flashdisk (bypassing windows and VMware), or change the wireless USB stick, or even try on a different wireless router…

Anything I can do again?

Hi,

When you talk about your gateway (lumi.gateway.v3), which one you refer exacly? Is the same as the image below?

In my case, the configuration that i have is this one, i don’t have mac and only the key, and works to me, i have more than 10 sensors…

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

As you say, time ago i also had problems with the discover of device, and i could see that problem was my router.

So try first my configuration, and if not works, then try to change router to see is that the problem, an you Trend AC6 block de multicast.

Hi @garvarma yes that is the model that I own. I have set the config as you suggest, but HA cannot find the device even after 10 retries

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - mac:
      key: oqidperh9lptaa6h

This results in error :

2018-08-27 11:21:20 WARNING (MainThread) [homeassistant.components.http] Experimental auth api enabled and legacy_api_password support enabled. Please use access_token instead api_password, although you can still use legacy api_password
2018-08-27 11:21:20 WARNING (MainThread) [homeassistant.loader] You are using a custom component for sensor.broadlink_power which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2018-08-27 11:21:20 DEBUG (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Expecting 1 gateways
2018-08-27 11:21:20 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 1)
2018-08-27 11:21:25 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 2)
2018-08-27 11:21:30 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi_aqara is taking over 10 seconds.
2018-08-27 11:21:30 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 3)
2018-08-27 11:21:33 WARNING (SyncWorker_0) [homeassistant.components.light.flux_led] Failed to connect to bulb 192.168.0.180, LED Tempat Tidur
2018-08-27 11:21:35 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 4)
2018-08-27 11:21:40 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 5)
2018-08-27 11:21:45 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 6)
2018-08-27 11:21:50 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 7)
2018-08-27 11:21:55 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 8)
2018-08-27 11:22:00 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 9)
2018-08-27 11:22:05 INFO (SyncWorker_2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 10)
2018-08-27 11:22:10 ERROR (SyncWorker_2) [homeassistant.components.xiaomi_aqara] No gateway discovered
2018-08-27 11:22:10 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi_aqara: Component failed to initialize.

How was your problem like? How do you find it was the router that block the multicast? May I know what is your router back then, and what is your current router now?

I just bought the Tenda AC6 a month ago, and I really hope that the router was not the culprit. Don’t know what my wife will say if I buy another router… :frowning:

How was your problem like? How do you find it was the router that block the multicast? May I know what is your router back then, and what is your current router now?

I don’t remember exacly, but first i had 1 router from my company of internet, then they changed my router and then the gateway didn’t appeared in HA, so I installed my old one to test, and with old one, the gateway discovered.

The one that blocked multicast was a livebox, then old one that i was using was a ZTE. Now i have a Unifi.

If you look in forum, about xiaomi gateway discovered problem, you can see about that some routers block the multicast. Ask a friend if has old router…

Look if configuration of hassio has bridge mode activated also…

Hmm… I’ve spoken to the live support of Tenda. Not the best customer support though… Waiting 30 minutes for an answer, and they just answer in two lines and disconnect my session… They said the router supports multicast, although I cannot find any setting regarding multicast in my router web-admin…

However, I will still try to find another router to check this out…

@garvarma what did you mean by hassio bridge mode? I’ve tried googling a bit about it, but still haven’t found any information about it… How do we check the bridge mode of hassio?

what did you mean by hassio bridge mode? I’ve tried googling a bit about it, but still haven’t found any information about it… How do we check the bridge mode of hassio

In my case i’m using HA in dockers option. In my case when i configure the docker, i need to put in bridge mode, that all devices works in the same network.

If you didn’t find anything, in google, then maybe is not necessary in your case.

Here you can find some info:

https://community.home-assistant.io/t/xiaomi-gateway-not-discovered/25030/68

https://community.home-assistant.io/t/xiaomi-gateway-integration-help-needed/28563/32

https://community.home-assistant.io/search?q=xiaomi%20gateway%20multicast

Sorry i must go now to work. Try to find other router from a friend and check this.

speaking of this docker thing… I went ahead and try to see whether my system is actually running on a docker… So, when I issue this command from SSH (putty), this is the result that I get :

Does that mean I’m running hassio in docker? If yes, how do I make it running in –net:host mode? I’m really lost here, and I’ve tried searching around for instruction to run the already-installed docker in host mode… Any help would be appreciated…

Well i don’t understand so much about hassio.

But first i will recommend try other router if in that case continue not working, then see other things, like bridge or maybe configuration of HA.

Hmm… I’ve tried using different router D-LINK L7-N-R2000 which have multicast capability (there’s a menu about that in the setting). But the error persist. It seems like the port 9898 is closed most of the time. It only opens for a second after I disabled-enable LAN access. I assume this is the bug of the latest firmware…

i dont think it is multicast issue. Cause multicast issue you still can discover the gateway but will keep give key error in the logs
Possible migateway bug.

Try this.

  1. turn off wireless communication protocol
  2. change the password by press the button(avoid password with L / i / o / 9 / g. Sometime, cant differentiate it.)
  3. turn on wireless communication protocol
  4. try connect using new password.
  5. if step 4 fail. Reboot your migateway and wait 5 mins after reboot. Then restart your home assistant.

Other things you can try is running hassbian rather than hass.io.
I has problem with hass.io which it only listen to my lan port and not my wireless.

You can also see the broadcast from migateway using ngrep

$ ngrep port 9898
interface: eth0 (192.168.xx.0/255.255.255.0)
filter: (ip or ip6) and ( port 9898 )
#
U 192.168.xx.xx:4321 -> 224.0.0.50:9898
  {"cmd":"heartbeat","model":"gateway","sid":"xxxxxxx","short_id":"0","token":"xxxxxxxxxxxxx","data":"{\"ip\":\"192.168.xx.xx\"}"}
#
U 192.168.xx.xx:4321 -> 224.0.0.50:9898
  {"cmd":"heartbeat","model":"gateway","sid":"xxxxxxx","short_id":"0","token":"xxxxxxxxxx","data":"{\"ip\":\"192.168.xx.xx\"}"}
#

thanks for the suggesntion @tyjtyj
I will once again try to disable-enable wireless comm protocol, changing the password…

I’ve tried ngrep port 9898 but I’ve waited 30 mins there’s nothing on port 9898… not a heartbeat from the gateway… I really think the gateway doesn’t want to open himself to the network…

Anyway, what is you nmap result to the gateway? could you please perform

nmap -sU 192.168.0.x -p 9898,4321 to your gateway IP?

I’ve tempted to try to install hassbian. But don’t know how to install hassbian on ubuntu desktop pc?

Seems nmap test not accurate

root@raspberrypi:/home/homeassistant/.homeassistant# nmap -sU 192.168.xx.xx -p 9898,4321

Starting Nmap 7.40 ( https://nmap.org ) at 2018-09-05 15:49 +08
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 1.04 seconds
root@raspberrypi:/home/homeassistant/.homeassistant# nmap -sU 192.168.xx.xx -p 9898,4321

Starting Nmap 7.40 ( https://nmap.org ) at 2018-09-05 15:50 +08
Nmap scan report for lumi-gateway-v3_miio4516xxxx (192.168.xx.xx)
Host is up (0.036s latency).
PORT     STATE         SERVICE
4321/udp open|filtered rwhois
9898/udp open          monkeycom
MAC Address: F0:B4:29:xxxxxxxxxxx (Xiaomi Communications)

Nmap done: 1 IP address (1 host up) scanned in 2.26 seconds
root@raspberrypi:/home/homeassistant/.homeassistant# nmap -sU 192.168.xx.xx -p 9898,4321

Starting Nmap 7.40 ( https://nmap.org ) at 2018-09-05 15:50 +08
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 0.80 seconds

Yes, nmap is rather unreliable over wifi… If you use cable like me, you will get far more success doing nmap.

I see you have port 4321 and 9898 open on Gateway… I never have those port opens, eventhough I reset the gateway multiple times, and disable-enable LAN access numerous times. I wish I could send you my unit to test.