Sleep as Android talks to Xiaomi Mi Band 2

Posted on Posted in Uncategorized

Sleep as Android talks to Xiaomi Mi Band 1&2

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.

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 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.

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)


45 thoughts on “Sleep as Android talks to Xiaomi Mi Band 2

  1. 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?

    1. 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.

      1. 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.

  2. Hola, mi mi2 esta bloqueada por no recordar el usuario o la clave, esta muerta, aun así podría ser operativa con vuestra app???

  3. 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?

      1. 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 ?

    1. 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.

      1. 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)

    1. 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.

      1. 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).

  4. 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?

    1. 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.

    1. 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.

  5. 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.

  6. 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?

  7. 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.

    1. 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.

    1. Hello Burak, no, we do not have automatic fall asleep detection as our experience with those algorithms is pretty bad – they’re very unreliable.

        1. 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.

          1. 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….

          2. 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…

Leave a Reply

Your email address will not be published. Required fields are marked *