Hi, I’m very new to HASS but did a lot of reading before starting to setup my home automation.
I’ve installed hass on Pi 3b+, and successfully got Yeelight working without any issues. Unfortunately that wasn’t the case with xiaomi gateway. Here’s what I tried so far:
disabling/enabling LAN
resetting the key
in config adding/removing/mixing combinations of mac, key, interface (even set the discovery rate to 50)
reset the gateway twice, even created a new xiaomi account (app set to region Mainland China)
opened port 9898 on my router (for ip listed in network info on the app)
If I don’t include the interface ip I always get an error ‘component failed to initialize’ / ‘No gateway discovered’. When interface command is included I get:
Error during setup of component xiaomi_aqara
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/setup.py”, line 148, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/xiaomi_aqara.py”, line 130, in setup
xiaomi.discover_gateways()
File “/usr/local/lib/python3.6/site-packages/xiaomi_gateway/init.py”, line 43, in discover_gateways
_socket.bind((self._interface, 0))
OSError: [Errno 99] Address not available
The one thing I just can’t understand is howcome when I just have a fresh configuration (ie no editing) the ‘discovery’ automatically finds xiaomi-aqara in the ‘overview’ tab (it’s listed on the top as ‘invalid config’)
Hub info:
version code: 208
model: lumi.gateway.v3
fw_ver: 1.4.1_161.0143
Would really appreciate any help as I literally have no idea what else I can do.
I specified the mac address without colons, like this format: 7c49eb1a2b3c
Just to be sure: the key is not the password of your Xiaomi account. Were you able to access the developer mode in the Mi Home app to generate the key? If not, you could follow these instructions: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
Are your xiaomi gateway and your Home Assistant in the same network subnet? Can you ping the xiaomi gateway from your HA?
You could turn on debug logging by adding the lines below to your configuration.yaml:
The gatewar and HA are connected to the same wifi.
Added the debug you suggested, but that doesn’t seem to trigger anything in dev logs
logger:
default: warn
logs:
xiaomi_gateway: debug
Also tried to add the ping, but apparently I’m doing something wrong:
xiaomi_aqara:
-platform: ping
host: 192.168.1.20
Getting following error with this code (the ip is correct, checked it on my router):
Invalid config for [xiaomi_aqara]: expected a dictionary for dictionary value @ data[‘xiaomi_aqara’]. Got [OrderedDict([(‘platform’, ‘ping’), (‘host’, ‘192.168.1.20’)])]. (See /config/configuration.yaml, line 99). Please check the docs at Xiaomi Gateway (Aqara) - Home Assistant
Edit:
Tried also completely removing the xiaomi_aqara code, getting exactly the same error from auto discovery:
Setup failed for xiaomi_aqara: Component failed to initialize.
No gateway discovered
It’s like my the config I apply doesn’t do anything.
Hi totolino, thank you for the suggestions, unfortunately that didn’t work as well.
Both devices are on home wifi network (vodafone UK), everything works perfectly fine on my phone, not sure what kind of setting I should be looking for on the router, I opened the port 9898 for the gateway IP but that doesn’t seem to be doing anything.
Either I’m an idiot or there’s something wrong with my gateway… anyways here are the screenshots from my phone and the code in configurator (tried both with and without mac):
Yes, I generated like 10 new keys.
Tried all the options listed:
LAN access enabled (as visible on the screen)
no firewall, running it from Pi image downloaded from HA website
router seems to be supporting multicast (default vodafone UK router)
removed/added/added blank mac
discovery always set to 10
reset LAN access several times
hard reset gate two times, even linked it with new xiaomi account just in case
don’t believe any other options listed are applicable for me
I’m changing the router (the one I have is rubbish anyway), will arrive tomorrow so will post an update whether that worked.
@thundergreen - what do you mean password is not the key? I followed all the instructions and that’s exactly what they say:
Follow the setup process using your phone and Mi-Home app. From here you will be able to retrieve the key (password) from within the app following this tutorial.
Unable to load /config/known_devices.yaml: Config file not found: /config/known_devices.yaml
@walaj thanks a lot for sharing this! seems like my case is exactly the one described, very disappointing… I might grab another gateway and enable lan before any fw updates
@tedsluis thanks for the link, enabled SSH and ping’ed the gateway, all fine (4-8ms).
I got the new router and nothing changed (as expected).
Connected without any issues to yeelight, xiaomi vacuum and dyson fan.
I guess it’s the fw issue @walaj mentioned before. Will buy a new gateway and open Lan before running any updates, hopefully this will solve the problem.
There is a know issue with firmware 1.4.1_161.0143 and compatibility with HA. Is has been discussed in many other threads on the forums for some time now.
Basic rule of thumb I have with anything that connects to HA is, if it is working, do not update it unless it is necessary because of a breaking change or adds a significant feature to the product that you can not live without.
Any news or tips regarding these issues?
Anyone knows a way to downgrade the gateway firmware?
I’m seeing a lot of issues with people who ordered recently …
I had a similar problem a while back and it turned out to be my Bell 2000 router. It did not support multicast very well. I changed it to a different router (TP-Link) that had multicast support and the Xiaomi gateway has worked flawlessly since then.