Xiaomi aqara not working in Hass.io

Greetings to everyone, first of all I apologize in advance for my english because its not my first language.

Im posting because im having some problems with my xiaomi aqara. Since I migrate from hassbian to hassio all my xiaomi sensors stop working (motion, door, temperature and humidity). If I reset my homeassistant after some minute it throw the following errors:

Cannot connect to Gateway
No data in response from hub None
Got error element in data {“error”:“Invalid key”}

Before you ask, yes the key on my homeassistant its the same from the xiaomi app and the IP and MAC adresses are right. When I was using hassbian it was working without problems, but in Hass.io for some reason there’s no way for me to make it work.

Some details that could be important:

  • Homeassistant version: 0.102.0
  • Hassio supervisor version: 192
  • Host system: HassOS 2.12

My config:

xiaomi_aqara:
discovery_retry: 10
gateways:
- key: !secret xiaomi_key
host: !secret xiaomi_host
mac: !secret xiaomi_mac

Please help, youre my only hope!

Please post your code properly.

Please see this sticky for how to format your code.

Sorry, here is my config

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - key: !secret xiaomi_key
      host: !secret xiaomi_host
      mac: !secret xiaomi_mac

From the integration page:

If you receive an {"error":"Invalid key"} in your log while trying to control the gateway light

  • You should generate the key again using an Android Phone or alternatively an emulator such as bluestacks. In some instances, there is an issue with keys being generated using the iOS application.
  • You need to make sure to have multicast support on your network. If you are running Home Assistant in a virtual machine (like Proxmox), try echo 0 >/sys/class/net/vmbr0/bridge/multicast_snooping on the host and restart the service or reboot the host.

Hello there,
I have the same issue. I use a docker container at a Synology nas.
I can control the light, but also get this error…I already changed the password on my android phone twice.
Have you any additional advice for me?

BR

Post your log

Here we go:

2019-11-23 07:26:05 INFO (MainThread) [homeassistant.setup] Setup of domain history took 0.0 seconds.
2019-11-23 07:26:05 INFO (SyncWorker_7) [xiaomi_gateway] Xiaomi Gateway 04cfaabbccdd configured at IP 192.168.0.1:9898
2019-11-23 07:26:53 ERROR (SyncWorker_6) [xiaomi_gateway] Got error element in data {"error":"Invalid key"}
2019-11-23 07:27:07 ERROR (SyncWorker_4) [xiaomi_gateway] Got error element in data {"error":"Invalid key"}

Hope this helps.

Have you been right through this? https://www.home-assistant.io/integrations/xiaomi_aqara/#troubleshooting

Yes I am. But with this part:

If you receive an {"error":"Invalid key"} in your log while trying to control the gateway light

  • You should generate the key again using an Android Phone or alternatively an emulator such as bluestacks. In some instances, there is an issue with keys being generated using the iOS application.
  • You need to make sure to have multicast support on your network. If you are running Home Assistant in a virtual machine (like Proxmox), try echo 0 >/sys/class/net/vmbr0/bridge/multicast_snooping on the host and restart the service or reboot the host.

I have the issue, that I don’t knwo how to make sure that Docker at my Synology is in multicast mode. The PW I already changed mutiple times. My Fritz!bos is in multicast mode…

BR

I think multicast works in docker if you are using --net=host. I am no expert in that though.

Hello nickrout,

this is what I found too, but I have no clue, where to enter it. :frowning:
BR

It is the standard way of running ha in docker, including on synology, see https://www.home-assistant.io/docs/installation/docker/#synology-nas

I think that would assume though that synology has multicast enabled. I am not really familiar with them. Can you access a shell and report what ifconfig or if report?

Mh, the report says everything fine…

docker0   Link encap:Ethernet  HWaddr 02:42:aa:bb:cc:dd  
          inet addr:172.18.0.1  Bcast:172.18.255.255  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

What should I do now?

BR

test it with nmap.

I did it and the response was:

> 9898/udp open monkeycom

So I know now that it should work…but what am I missing?

If my new Aqara gateway ever arrives, I may be able to parallel troubleshoot. Meanwhile, I have five of the smart mini-switches just waiting for the gateway. :frowning:

I ordered five of the by mistake had have no clue what to do with them. But first my gateway should work properly…

Well, strange things, from one moment to another my aqara gateway start working once again. I don’t know if it was fixed because i change some things in my config related to ifttt (i dont think so but as i say from one moment to another it fix magically) but from that moment work just fine. Thanks anyway!