hello my mi5 is on 7.1.20 all i have to do is go to /sys/devices/soc/
look for a folder called soc:fpc_fpc1020 inside there is a file called enable_wakeup
change the value to 1 and it will work
you need root and an app to get access to the file system of the phone
the only thing that happens is every time you reboot you phone you have to do all the process again