Xiaomi aqara gateway and pfSense IGMP proxy

Tags: #<Tag:0x00007f7392c31650> #<Tag:0x00007f7392c313f8> #<Tag:0x00007f7392c312e0>


I read a lot of topics about this, and even more other site’s, but couldn’t get it to work.
I keep getting the following error:

Log Details (ERROR)

Tue Dec 04 2018 22:19:51 GMT+0100 (Midden-Europese standaardtijd)

Got error element in data {“error”:“Invalid key”}

I know it has something to do with multicast, and tried IGMP and avahi. But I couldn’t find anywhere what settings exactly to use.

I am using pfSense, with multiple VLANs. I have a server VLAN, with each server independently allowed WAN access. And a IoT VLAN, with only the access needed to my Hass.io server.

So, Hass.io is in the server VLAN, and the gateway in in the IoT VLAN. For testing, I enabled WAN access for the gateway, and updated the firmware.

I added the following config:

  discovery_retry: 5
    - mac: 7c49eb195f7a
      key: xbb589o0fz381q7i

The gateway does show up in HA, and I see the light and switch (I have a button connected to the gateway).
But that’s it. I cannot control it from HA, and the button status doesn’t get forwarded to HA.

Can someone help me configure pfSense to get this working?


Hi Erwin,

did you manage to get this working? I have a fairly similar issue (different router). I had the gateway working for a couple of days, but this morning it couldn’t find the gateway anymore. Initially, I just had the key specified in the config. When I added the mac and host in the config, the gateway was detected and available in Home Assistant again. When I turn on the gateway light via HA, the light turns on, but the switch reverts back to the off position (light stays on) and the log generateds the ‘invalid key’ error. Also the connected sensors don’t work either.

It’s a bit of a puzzle, since it worked initially. And without changing anything in the config or network it just stopped working. I also figured it must have something to do with multicast and enabled IGMP Snooping in my router. That didn’t have any effect, other that breaking connectivity to my Sony Soundbar. So I turned it off again.

Hi, I figured out my issue. Totally unrelated for you, but I thought I’d share :slight_smile:
I’m running my HA in Synology (docker) and have an OpenVPN connection running permantly on my Syno (as default gateway and with multiple gateways option enabled). This worked great in the past, but for some reason it doesn’t anymore. When I turn off the VPN, the Xiaomi Gateway works like a charm. This happened after I rebooted my Syno, so it might be a bug to do with the multiple gataways option on the NAS. I’m looking into this further.

Did you find a solution? I am experiencing the same problems

No, I ended up using a 433 MHz RF button with OpenMQTTGateway.

connect your hass.io using wifi(dont use lan cable and wifi ONLY) with same vlan with your xiaomi gateway. I managed to fix this with firewall that block multicast.

Take, but I can’t use this solution.
My hass.io is on a VM, on a vsphere server. So I don’t have WiFi available.
My hass.io is on the server vlan, all my iot stuff is on a iot vlan. I don’t trust the Xiaomi gateway on my server vlan.

Maybe someone else can use your solution, so thanks for sharing.
If I find a solution for me, I will let it know here.

Did anyone find an answer to this.
I have the same/similar issue. My hassio instance is running in proxmox and on my LAN but i put the gateways on a separate (Unifi) VLAN but it now gives me the:

Got error element in data {“error”:“Invalid key”}

any ideas greatfully received