It was a long quest. Starting with the introduction of the first version of the budget band from Xiaomi, we have been flooded with requests from you, the users of Sleep as Android, to make good use of the band.
Unfortunately, there was no documented protocol which we could use and the task seemed repeatedly possible and impossible with the efforts of various independent developers who seemed to crack the Bluetooth protocol that Mi Band used.
But Xiaomi always stroke back and changed the protocol.
After a long long long and seemingly impossible quest to get Mi Band talk to Sleep as Android, we got a word from Zdenek Horak, the author of Tools & MiBand (called MiBand Tools then) that he might be able to get this relationship working. But even for him, it was not an easy task, and even Zdenek felt at times that it’s an impossible thing.
But he didn’t give up. And finally, here we are.
Today, we can announce that Sleep as Android supports Xiaomi Mi Band 1&2!
How to:
For the integration to work, please buy & download the amazing Tools & Mi Band – the best Mi Band app on Android – Sleep as Android gets a full featured Mi Band support.
UPDATE: Sleep as Android is also supported by Notify & Fitness for Mi Band.Thanks Matteo!
Motion tracking (sleep phases tracking)
Enable Settings > Wearables > Use wearable.
Heart rate measurement
You need to enable heart rate in Tools & Mi Band:
Go to Tools & Mi Band > Navigation drawer > Heart rate > Settings and set the interval at which you want heart rate to be measured. This will then send heart rate to Sleep as Android at selected rate during sleep tracking.
You also need to enable heart rate monitoring in Sleep as Android:
Enable Sleep as Android > Settings > Wearables > Heart rate monitoring.
And battery life? With a full charge, you get to 95% in the morning after a whole night’s track. So we are probably better off than the Pebble (RIP)…
CAUTION: Sorry Mi Band 1 users, the integration only works with the Mi Band 2 with the newer firmware. For Mi Band 1 it is not technically possible. No access to its data.Mi Band 1 has been integrated as well! Please see Now Sleep as Android talks Mi Band 1+2 (-1S)
156 thoughts on “Sleep as Android talks to Xiaomi Mi Band 1&2”
Wow!
Is this support going to be guaranteed for future FWs of Mi Band 2? What happens if Xiaomi changes their protocol again? You don’t have any direct collaboration with Xiaomi?
Hi Nemanja, no, it is not guaranteed. We do not have direct collaboration with Xiaomi – they are not interested in any collaboration. If Xiaomi changes the protocol again, there are 2 ways to address this – 1) you don’t have to update your firmware, and 2) Tools & Mi Band will try to keep up with the FW changes.
Everything is great, except one major thing. Your app does not have automatic fall asleep detection as Mi Fit app has. You assume, that when i press sleep, i instantly fall asleep, but i am not. Is there a plan to use some kind of automatic falling asleep detection, maybe borrow that data from Mi Fit app. Without that all your data looks useless, and wrong. I am disappointed by lack of that feature. It looks like i am not gonna buy your app if no automatic falling asleep detection is implemented.
I’d like to know the answer as well.
You can’t get it exact, but you should know about how long it takes you to fall asleep. You can set sleep tracking to delay for a set period of time. For instance, mine doesn’t start tracking until after 15 minutes.
Me too
Same question. Can we get an answer for this one please?
That’s what I was wondering…
+1
Hi Linas,
the app HAS a fall asleep detection feature, but it is in experimental status that is why it is disabled by default. You can enable it from Settings — Sleep Tracking — Awake detection.
A new level (awake) should appear on your sleep graphs above light sleep.
Hey there! I’m not sure, but Google Play says Mi Band tools now supports MiBand 1 and 1S!
Upset a bit, my new MiBand 2 comes yesterday:)
Dunno what to do with old 1S:)
Hola, mi mi2 esta bloqueada por no recordar el usuario o la clave, esta muerta, aun así podría ser operativa con vuestra app???
Hello, my mi2 is blocked by not remember the user or key, this dead, still could be operational with your app??
Hello Jose, I do not understand the issue — could you please contact us at support@urbandroid.org and clarify a little?
Does it use heart rate sensor for betters sleep phase detection ?
it says it does on sleep as android page, but it seems it does not because i cant see the light turning on during sleep track
Please see the updated post.
It seems you ignoring my posts…
I was so excited about this and tried it last night. I connected Mi tools and sleep, turned on sleep tracking, and it found the band, but this morning I see sleep only recorded the first minute of the sleep. What went wrong?
Hi Maureen, could you please send a debug log (menu > report a bug)?
How your app supposed to work, i just installed it. Connected mi band 2. And i am sitting but it starts to track my sleep. whats going on ? Is there a manual or something ?
I have the exact same problem, only that for me it stops sometimes random during the night. It only records 50% of the night on average and has no data for the rest, so it says my sleepduration is like 3 to 4 hours…
Not sure if it is a Sleep as Android or Mi Band Tools problem or maybe it is my custom rom?
Will send a debug log.
Same here. I don’t know if that has something in common with heart rate monitoring setting in Mi Band Tools. I had continuous monitoring and Sleep as Android recorded complete heart rate data, but other data influencing the calculation of sleep length sopped working after few hours. I have only one complete sleep record for a few days in which I tested. (SGS7)
This should be fixed in the update of Tools&Miband from 20 May.
Hi ! Great Job !
Does it support HR detection too ?
Yes, please see the updated post…
Does it use heart rate sensor for betters sleep phase detection?
We use heart rates for better detection of awake state. We are not yet using it for sleep phases detection, but we are planning to do the research since there are indications that it might be possible.
Please contact MI Band Notify & Fitness developers. They manage all data from MI Band (2) quite fine, including falling asleep (even with official MI Fit uninstalled).
Any updates on using HR for phases detection? Thanks!
I’ve enabled timely HR measurements in Tools and Wearables and HR detection is on in Sleep, but I can’t see my HR graph in results. But I see my HR during the sleep recording on the screen. Any hints?
Please send us a debug log (menu > report a bug) after sleep tracking for a while with the HR measurement…
Hi, not really…we’re looking forward to finding time to work on heart rate variability to detect them, but we haven’t had the chance yet…
I have a pro kam that few times a day sleep as android turns on our of the blue and start tracing my sleep. I have no idea what triggers it.
Hi Jacek, this should be fixed now with the new updates of Tools and Sleep.
Works great except if I get up to use the bathroom it switches from the band to the phone. Also not sure if it’s using the heart rate sensor or not
Hi, regarding the heart rate, please see the updated post.
What settings do I enable in sleep for android app?
Settings -> wearables -> heart rate monitoring
Then do I enable
Bluetooth smart or android wear, Garmin, pebble?
Hi Russell, I have updated the article with better information. In Sleep, you don’t have to enable anything regarding heart rates, they are pushed from Tools and Miband.
I have a new issue. Today when I woke up I found that Sleep as Android was connected to my neighbors chromecast. I felt that to be a tad strange.
Hi Robert, if you have Settings > wearables > Bluetooth smart enabled, then we check for all devices in range if there is any heart rate transmitter. If we find one, we connect to it. It might have looked as if it’s connected to the chromecast, but it was not connected, just checking if there are any exposed heart rate characteristics.
I’m thinking of buying a Mi Band 2 to work with Sleep as Android. If I install “Tools & MiBand” do I also need to install the official Xiaomi app (Mi Fit or Mi Sport or whatever)?
I ask because in the last few days people updating Mi Fit have noted the new releases are broken, they can’t pair the band and phone anymore. Also I do not want to send Mi Band information to Xiaomi through their app / login system.
I will only use the Mi Band 2 for sleep tracking, so I just need confirmation that out of the box it will pair and work with just “Tools & MiBand” and I don’t need to install Xiaomi apps that will be broken or break in the future.
You need the official mi fit app to make it work unfortunately
Hey Guys,
First of all, thank you for making this possible. For me this was the most anticipated functionality update of an app ever.
But I also experience the problem of random abortion of the sleep tracking after something between 20 and 90 min.
Any ideas/suggestions/solutions?
Hi So, this should be fixed in the latest update on Tools & Miband.
Is there any reason that you quit collaborating with the developer of “Notify & Fitness for Mi Band”?? I already have a pro version of the aforementioned app and had been using it to work with the MI 1S band for sleep analysis. It was able to access the sleep data from that older band as well as the new MI Band 2. I really do not want to have to switch to the other app and pay for that to be able to use my MI 2.
Hi Dan, we never collaborated with them. If it was working and now isn’t, it’s most probably because Xiaomi changed something, but we wouldn’t know about it. It would be better to ask the developer of Notify & Fitness.
Awesome news, waited for years for this!
Hi can you tell me what version I need on my miband in order for this to work? My app keeps telling me my bracelet version is not supported, please help!
It should work for all mibands except 1S (which is 1 with HR sensor)
Hi. Does automatic fall asleep detection work?
Hello Burak, no, we do not have automatic fall asleep detection as our experience with those algorithms is pretty bad – they’re very unreliable.
LOL,in other words ,you cant code the proper algorithm into the app as the offical mi band 2 app and my notification and fitness
The algorithms in the apps you mention are also very unreliable, in fact every algorithm is because the problem is not solvable by algorithms, if all data you have is from the accelerometer/HR sensor. Try to lie down in your bed for several minutes, it will flag that as sleeping. There is no way to distinguish a sleeping person from e.g. a person lying in a bed and reading, or playing a game on a smartphone. I don’t think that’s something to LOL about.
Right answer. Even the Mı fit App cannot detect that properly. Just last night its detected my fall asleep time wrongly. I was just laying in my bed and watching a video. Don’t know what kind of algorithms those apps use but tracking your heart beat over a period of time could be a working solution since your heart beat drops significantly when you sleep. So the app has to learn over a period of time what your heart beat looks like in different situations like laying still, waking up, sitting, driving, sleeping….
Hi, the heart rate is a good pointer, but still insufficient. It’s not as simple as tracking a drop in HR, there is much more variability in heart rate during the day and night that interferes with this a lot…
I love how readers of the blog are advising Sleep As Android’s developers about how to do sleep detection technology.
HR data can be used supplementary to other data, so Sleep could then notify user with something like “it seems you where asleep from time A to time B, where you?” So that used could confirm or not to help application better understand what was going on. Something similar was implemented in Jawbone wearables, very accurate tracking software to my experience albeit utter crap of a gadget itself.
Integration does not work. I only get few sleep phases and everything else is flat. Duration is calculated apparently based on these recognized phases, thus showing false deprivation.
Few screenshots: https://drive.google.com/open?id=0B4zVE8UIAIvcMk5OQWRXVHl2NGM
Do you have Google Fit integration in both Sleep as Android and Mi Fit turned on? Mi Fit feeds wrong data to Google Fit, which in turn feeds them to Sleep as Android, thus making a mess out of your sleep stats. Please ideally switch Mi Fit – Google Fit integration off.
Sleep as android isnt detecting my miband 2….when testing it says searching but doesn’t detect and automatically puts on the phone measuring system
Hello, could you please contact us on support@urbandroid.org and describe the steps you are taking to connect miband?
Is the integration still working after latest Mi Fit app update? Also, how/where can I check if an official Mi Fit update breaks the sync in the future? Thanks
Hello, yes, it is still working. There is no way of telling beforehand if an update will break the sync unfortunately.
Hey, Jiri. How are you?
Firstly, sorry for my English.
Do you already know the app XSmart Alarm? It really works and always detects the movements during light sleep. It would be interesting you contact its author. Regards.
Quite correctly answered. However, it is possible to achieve near perfect or high accuracy (with the right threshold to balance false positives vs false negatives) for the automatic sleep tracking based on HR, actigraphy of a wearable, accelerometer of the phone and potentially behavior tagging for personal patterns (the latter being most complicated). Say if you phone lies next to the bed, your HR rate goes up and the actigraph shows a sequence corresponding to standing up, turning a light switch and using the toilet (probably a very consistent pattern :P). If you give users the option to tag this pattern, you generate a treasure trove of data..
Hi, I’m wondering if there is a possibility to activate the “snooze alarm” by tapping on the metal sensor of the Mi Band 1 instead of tapping the button on the phone display.
Is there an implemented function already?
Hello, please contact Zdenek Horak at info@mibandtools.com about that…
What is the advised interval setting for heart rate monitoring if I want to use it for detecting awake state? Is 5 minutes often enough? Or should it be more often?
The rule of thumb is that you should set it to the shortest interval you want to detect. If you set it to 5 minutes, you’d be able to detect awake states that last ca 5 minutes at least.