Lockscreen does not unlock on alarm (Xiaomi, MIUI)

On Xiaomi/MIUI, you need to grant special permission to Sleep as Android so that it may unlock your screen during alarm. Go to System Settings > Permissions > Advanced Permissions > select Sleep app and give it permission to access Lockscreen.

Huawei/Xiaomi sleep tracking interrupted

Huawei together with Xiaomi are the most troubled phones on the market, some vendors tent to ignore Android best practices and implement very bizzare custom modification which make background task nearly impossible to run. Please take a look at http://sleep.urbandroid.org/documentation/faq/alarms-sleep-tracking-dont-work/