I'll give that code a whirl just to experience it. But I wont be using these devices because I want to natively supported devices as much as i can.
My hub is like 5feet from the xiaomi sensor haha im still in setup phase. (just received my hub yesterday!)
I mostly have z-wave stuffs.. i've been doing HA for almost 10yrs actually and out of all experience i have to say hands down z-wave is quality stuff.. specially w/ OEM/generic options from China. Z-wave is more strict in implementing their standards while Zigbee is flaky as u see with xiaomi doing their own thing .. stupid really. i hate it.