Xiaomi Aqara - Invalid Key issue

Hello, not longer an issue for me, but just wanted to share a possible solution for someone else who might encounter the same problem as me, took me 2 weeks to solve it.

My setup is Home Assistant running in Docker in a virtualized Fedora with multiple NIC’s inside ESXi with pfsense virtualized too (apparently it shouldn’t interfere because of layer 3 inside same subnet) connected to the Xiaomi Gateway through an Unifi AP powered by a UTT POE switch connected to a TP-Link vlan switch.

I messed around with the AP, TP-Link switch, even with pfSense, but in the end I had to add to configuration.yaml: the interface (very important with multiple nic’s) , mac, key and host (also important).