I use an Xiaomi Gateway since 2 years now it's the V2 version without Homekit.
This summer I have rebuild my domoticz installation with the last Stable version of domoticz :
Version: 2020.2
Build Hash: b63341bc0
Compile Date: 2020-04-26 13:47:55
dzVents Version: 3.0.2
Python Version: 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0].
I have never issue before this rebulding but now I have some time issues in the log like :
XiaomiGateway: unable to write command - Invalid key.
The Gateway and the Devices works but it's not stable .....
The switch works after two or three clik or double click or long clik ....
The motion detector work sometime, same for the motion detector and the doors switch .....
I have double check my password in my Xiaomi application and I have also try to change this password without succes
I have delete my xiaomi Gateway in Domoticz and add again without succes
I have delete the gateway in my xiaome application on the phone and add again without succes
If I deactivate and reactivate the gateway, it's okay for the moment, the errors come back later
To summarize it works when he wants

No issue when I check directly in the Xiaomi application in my phone.
If you knowsomething about that I take it !!
In the last version of Domoticz we have ID and Password when you add the Gateway but in my last version there was just Password, what is the ID, maybe it's the token of the Gateway ?
Have a good day.