Just thought I'd report back on this, the macro works fine on my phone now, I guess MIUI didn't like it waking up every second to check if the device was unlocked, seems to tolerate the 10 second loop to flash the torch fine.
BUT - it still gets stopped on my partners phone (same model and OS...