Xiaomi sensors and switches only works for a few minutes

There is already this being discussed - Xiaomi devices do not work well. Create diag report from the Homey and contact Athom, assuming you are on latest FW. I ended up using my old Xiaomi v2 gateway, 2 months ago, was just hoping this issue will get fixed soon.