Hi, early days in coming to grips with HASS, and I have successfully configured a number of standard devices, however the XIAOMI gateway stubbornly remains undetected, with typical ‘No gateway discovered’ ‘Setup failed for xiaomi_aqara: Component failed to initialize.’
Troubleshooting to date: I’ve tried stipulating the host IP in case there is a problem with multicast on my router, with no success. I’ve tried various combos of IP, host gateway address with same results. The only thing different is that I’m running HASS from docker on a synology NAS. Is there something additional here I need to take into account? The container is running in the same network as the NAS, gateway etc.
Any advice and suggestions gratefully received, I really want to try out all those cheap XIAOMI sensors!
Yes, I believe this is already done. When installing, a bridge is created for the docker container, so it appears on the same LAN. I’m successfully discovering and configuring a heap of LIFX lights, media devices, and surprisingly my Samsung TVs. But the XIAOMI gateway appears invisible.
Note: The Mi-Home app is picking the gateway up too, no problem.
Bridge and host are not the same. Even the xiaomi docs specify that you need host networking
If you are using Home Assistant in Docker, make sure to use --net=host
Guess you may be able to get around it using the host configuration option, since that stops it from using multicast discovery for finding the gateway.
I tried using the host configuration once already with no success. I’ll give a second try - I recall I received errors but can’t recall what the actually were.
No - exactly the same.
2018-02-01 04:32:24 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi_aqara is taking over 10 seconds.
2018-02-01 04:32:39 ERROR (SyncWorker_1) [homeassistant.components.xiaomi_aqara] No gateway discovered
2018-02-01 04:32:39 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi_aqara: Component failed to initialize.
2018-02-01 04:32:44 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
The only option I’m not sure about is specifying the INTERFACE option. Is this my router IP address?
No, the interface option is used to select which network interface on your home assistant server to use. You should however normally not need to set this, so remove that setting and set net=host and see if that works.
I’ve verified docker is running under the host network. The only thing that might interfere with multicast is running 2 bonded nics.
All Unifi network settings say that multicast is enabled, including igmp snooping for the WAN its running on, however i’m specifying the gateway IP address anyway.
Just an update for any newbie discovering this thread
HA on docker/synology works just fine with the default config in docker when setting up. My problem was simply not paying enough attention to the Mi HOME app and the development key you need to CAREFULLY note and activate. I was confident I done this correct. Ha! 1) Make sure you have flicked the LAN protocol to ON switch and 2) double check that key because it’s dead easy to misread and include a wrong key in the HA config -and- 3) if it doesn’t work, try generating a new key.
Is there any possibility to have home-assistant not run with --net=host, but still using the Xiaomi gateway?
Can I open a specific port for this? I know the IP adress of my gateway.
In docker (in my case docker compose), open this udp ports:
ports:
- "9898:9898/udp"
- "4321:4321/udp"
I have a custom network (bridge) in my docker conf, but I suppose works as well with default bridge network because we are calling ip address instead hostname.
My xiaomi gateaway becomes unavailable after a few hours. I had to restart home assistant just to get it detected again and I’ve had to repeat this step several times.
Same here. Host is an Ubuntu instance. Network is configured as host. Gateway is configured using integration. Works fine on a non-docker setup and against an older ha version.
Getting events from gateway intermittently. Switches work fine.