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


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

  1. Could you extend the documentation to include that you need to setup heart rate monitoring in the Mi Band tools as well as in the SaA app? Also, would it be possible for Mi Band tools to automatically start heart rate monitoring when sleep starts in SaA? Otherwise the Xiaomi band will monitor my heart rate all day. I know I can set a time interval in Mi Band, but this would only be an approximation of my sleep recording times.

    1. Hello, to change the heart rate settings in Miband Tools to start only with Sleep, please contact their author.
      Regarding what needs to be set up, I have updated the docs.

  2. In tools & miband app it states that it is possible to snooze an alarm in sleep as android with just pressing the miband button. I turned this function on but it doesn’t trigger anything when the alarm rings. Is there a solution?

  3. Dear Jiri Richter and SaA (Sleep as Android) Team,

    Great work! I love the application, it helps me to wake me up in the morning on time.

    About this article, I have a question…
    You said it need MBT (Mi band tools) continuous HR reading to work. But I notice there’s already HR sleep assistant on Mi fit official app.

    Why SaA app can’t read from Mi fit official app?
    Should I enabled both?
    Or on MBT only?

    Best Regards.

  4. What about heart rate measurement option in Sleep as android? “Mi band” is listed in description of the switch which turns it on (Settings=>Smartwatch=>Heart rate measurement), but still we need to set up heart rate measurement in Mi band tools. Why?

    1. This is because Mi Band Tools is the middleman who has deciphered the Heart rate protocol from mi band. So effectively Mi Band Tools is the provider of the heart rate data, and Sleep is the receiver.
      You control both sides of the relationship. In Mi band tools you enable sending HR data, in Sleep receiving HR data.

  5. In tools & miband app it states that it is possible to snooze an alarm in sleep as android with just pressing the miband button. I turned this function on but it doesn’t trigger anything when the alarm rings. Is there a solution?

  6. Hi,
    Do you think Mi Band 2 does a good work on the sleep tracking? I’m asking because i already read somewhere that the data showed by the Mi Band 2 are not much accurate.

    Please, someone answear asap.

    Best regards

    1. Hello Francisco, Mi Band 2 is very accurate. In fact it is accurate the same as any other band or smartwatch. At the heart of the band is a motion sensor called accelerometer which is a really well produced and standardized component. Nothing can go wrong there. Sleep as Android gets raw data from the accelerometer and works with them.
      What have you most probably read is that the processing done on the data by the Mi Fit app is tad crappy. We circumvent Mi Fit and get directly at the raw data, so this inaccurate step is out of the way.

  7. Hi. Could I use SaA in this way: setup a morning alarm in app, sync it to mi band, turn off Bluetooth and do not use app at all. And in the morning sync mi band with the app?

    1. Hello Pikaro, on our side we do not need Play Services to track sleep, however Miband Tools seems to need it since they need to have strong anti-piracy checks that use Play Services. Miband Tools is a heavily pirated app and since it’s a sole income for its developer, it needs to deal with it.

  8. Hello, I’ve got a problem. I tried so many apps using my MiBand 2 (Mifit, MibandMaster, GadjetBridge, and now MiBand Tools). I don’t understand how your apps works. Indeed, there is a big difference about the deep sleep between all these apps:
    – Mifit: 32min deep sleep (for 6h00 of sleep)
    – Miband Master: 1h27 deep sleep (for 6h of sleep)
    – Sleep As Android: 3h deep sleep (for 6h00 of sleep)

    Can you explain me how is a such difference possible ? And each night it’s the same problem. Even if we don’t care about MibandMaster, the difference between the official mi app and SaA is impressive..

    Thank you in advance

    1. Hello, this is because every app uses their own take on the sleep phase detection algorithms. They are based usually on Sadeh / Cole-Kripke algorithms, but as they are pretty old and not perfect, most probably each app has some modifications of their own. We believe that our modifications of the algorithms are realistic, but of course there can be no real comparison as the algorithms are proprietary.

Leave a Reply

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