Xiaomi gateway not found

Hi,

I am a newbie and I am trying to install the hass on my windows laptop to give it a try. I have a full range of Xiaomi devices & GW.
I have the Xiaomi Mi Gateway and not the Aqara one.
Firmware: 1.4.1_161.0143

I followed the instruction for the installation:

  • Installing Python virtual enviroment
C:\...\> py -m venv homeassistant
C:\...\> cd homeassistant
C:\...\> Scripts\activate.bat
C:\...\> py -m pip install wheel setuptools pip
C:\...\> py -m pip install homeassistant

But when I execute the
C:\...\> hass
I get the following:

ModuleNotFoundError: No module named ‘win32api’
2019-01-07 10:10:36 INFO (SyncWorker_4) [xiaomi_gateway] Gateway discovery finished in 5 seconds
2019-01-07 10:10:36 ERROR (SyncWorker_4) [homeassistant.components.xiaomi_aqara] No gateway discovered
2019-01-07 10:10:37 INFO (MainThread) [homeassistant.setup] Setup of domain xiaomi_aqara took 5.1 seconds.
2019-01-07 10:10:37 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi_aqara: Component failed to initialize.

Browsing around, it seems I need to have a configuration.yaml file. I couldn’t find that file in the homeassistant folder. I have the following structure of the folder

Include folder
Lib folder
Scripts folder
pyenv.cfg

What shall I do at this stage? How & where can I have the configuration.yaml?

Thanks a lot in advance
Moh

I am no Windows guy, but maybe try this:

Thank you dear,
I can see that it has recognized some of my devices (in bold) but still getting the same error. I have found the location of configuration.yaml %APPDATA%/.homeassistant
How can I define my GW then?

2019-01-07 10:37:48 INFO (SyncWorker_8) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 1)
2019-01-07 10:37:50 ERROR (SyncWorker_12) [homeassistant.components.light.yeelight] Failed to connect to bulb 172.21.1.109, yeelight_strip_7811dca229a2: A socket error occurred when sending the command.
2019-01-07 10:37:53 ERROR (SyncWorker_3) [homeassistant.components.light.yeelight] Failed to connect to bulb 172.21.1.111, yeelight_strip_7811dc6917ad: A socket error occurred when sending the command.
2019-01-07 10:37:53 INFO (SyncWorker_8) [xiaomi_gateway] Gateway discovery finished in 5 seconds
2019-01-07 10:37:53 ERROR (SyncWorker_8) [homeassistant.components.xiaomi_aqara] No gateway discovered
2019-01-07 10:37:53 INFO (MainThread) [homeassistant.setup] Setup of domain xiaomi_aqara took 5.1 seconds.
2019-01-07 10:37:53 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi_aqara: Component failed to initialize.

Have you checked the docs?

Yes I have added the below, but still seems not able to recognize it

xiaomi_aqara:
  discovery_retry: 5
  gateways:
   - key: xxxxxxxxx

and

xiaomi_aqara:
  discovery_retry: 5
  gateways:
   - host: 172.21.1.112
     key: xxxxxxxxxx

I am getting the following:

2019-01-07 11:01:05 INFO (SyncWorker_10) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 2)
2019-01-07 11:01:09 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi_aqara is taking over 10 seconds.
2019-01-07 11:01:10 INFO (SyncWorker_10) [xiaomi_gateway] Gateway discovery finished in 5 seconds
2019-01-07 11:01:10 INFO (SyncWorker_10) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 3)
2019-01-07 11:01:15 INFO (SyncWorker_10) [xiaomi_gateway] Gateway discovery finished in 5 seconds
2019-01-07 11:01:15 INFO (SyncWorker_10) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 4)
2019-01-07 11:01:20 INFO (SyncWorker_10) [xiaomi_gateway] Gateway discovery finished in 5 seconds
2019-01-07 11:01:20 INFO (SyncWorker_10) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 5)
2019-01-07 11:01:25 INFO (SyncWorker_10) [xiaomi_gateway] Gateway discovery finished in 5 seconds
2019-01-07 11:01:25 ERROR (SyncWorker_10) [homeassistant.components.xiaomi_aqara] No gateway discovered
2019-01-07 11:01:25 INFO (MainThread) [homeassistant.setup] Setup of domain xiaomi_aqara took 25.9 seconds.
2019-01-07 11:01:25 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi_aqara: Component failed to initialize.
2019-01-07 11:01:25 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 26.67s
2019-01-07 11:01:25 INFO (MainThread) [homeassistant.core] Starting Home Assistant

Does it mean it recognized the GW?

the logs keep on going and then it hangs on the following:
ata\Local\Temp\pip-record-tqddh0pr\install-record.txt --single-version-externally-managed --compile --install-headers c:\windows\system32\homeassistant\include\site\python3.7\curve25519-donna" failed with error code 1 in C:\Users\MOHAME~1\AppData\Local\Temp\pip-install-ls9s4uho\curve25519-donna\
2019-01-07 11:01:51 ERROR (MainThread) [homeassistant.requirements] Not initializing apple_tv because could not install requirement pyatv==0.3.12
2019-01-07 11:01:51 ERROR (MainThread) [homeassistant.setup] Setup failed for apple_tv: Could not install all requirements.
2019-01-07 11:01:51 INFO (MainThread) [homeassistant.components.light] Setting up light.yeelight
2019-01-07 11:01:51 INFO (MainThread) [homeassistant.components.light] Setting up light.yeelight
2019-01-07 11:01:53 ERROR (SyncWorker_9) [homeassistant.components.light.yeelight] Failed to connect to bulb 172.21.1.109, yeelight_strip_7811dca229a2: A socket error occurred when sending the command.
2019-01-07 11:01:55 ERROR (SyncWorker_13) [homeassistant.components.light.yeelight] Failed to connect to bulb 172.21.1.111, yeelight_strip_7811dc6917ad: A socket error occurred when sending the command.

nope - it failed to find it

have a look at Xiaomi Gateway and Hass.io - #3 by RolfKoenders - there have been issues with multicast support for some people.

Are these direct or via the xiaomi gateway?

Given you are running this on a windows machine, consider checking what windows firewall is doing (and blocking…)

  discovery_retry: 10
  gateways:
    - mac: 
      key: xxxxxxxxxxx

Try this, had the same struggle…

Oh and funny fact: VPN messes your system up. Xiaomi won’t be found if ur HA device has VPN enabled.

Regarding the VPN issue, that is because everything is then routed via the gateway of the VPN. You can still use the VPN, but you will have to create a static route to force the multicast traffic to your lan gateway.

I get this happen to me a but, but its fairly intermittent.

When it happens, the only option i have is to restart to xiaomi gateway. Nothing else works. I can ping it, connect to it on the relevant ports, etc – but HA just wont find it.