Problem with xiaomi hub

I have a setup with a xiaomi hub and multiple sensors (temperature, presence, switches, etc…).
Everything was working great until yesterday. All the sudden it stopped working and gives the following error:

ERROR (Thread-2) [xiaomi_gateway] Unknown gateway ip 192.168.1.2

That IP is the IP of my qnap and the IP of hass. I have no idea what it means. I can use the hub fine with the android application.
I’ve also tried everything I could remember: reset the hub, remove the hub from the app, turn off and on the lan protocol, change the key, tried on android and ios, upgrade hass to the latest version, nothing works.

Has this happened to anyone else? How did you fix it?

Thanks!

I’ve dig into this and it seems that I actually have two different problems. There’s the one I’ve described before but even thought that happens I can still see the gateway on hass, access it and control it to some extent.

I cannot interact with it properly. For example, if I turn on the light, it will give me an error saying that the key is invalid. Albeit the error, the gateway turns on the light. Also, I’ve double check the key multiple times and it is correct.

I’ve dig into the code to try to understand what is happening without much success. I’m not familiar with python. I was trying to probe the part where hass gets the response from the gateway to understand why is giving me a key invalid error but I have no idea where that happens.

For example, on the XiaomiGatewayLight class there the method self._write_to_hub() where I think is where the magic happens but I have no idea where this method is implemented. I’ve looked in it’s parent class, is not there. I’ve searched for it on the whole project and nothing.
When I’ve dumped some variables, I’ve come across a XiaomiGateway object but once again I couldn’t find its class definition.

I might be missing something very basic. If someone could point me in the right direction I would be happy to dig a little deeper and try to solve this issue.

Hello I’ve same problem, on lxc container, you have solved??