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

  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.

    1. Please enable only the MBT heart rate….we cannot read directly from Mi Fit because we don’t have knowledge of the Mi Band protocol. Mi Band Tools does.

  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, this is not possible since we are unable to store any data on Miband. We can only connect to the data stream that flows out of the miband.

    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.

  9. I don’t really get what SaA adds to the existing T&MB functionalities. Since I’ll have to pay for T&MB, why not use the alarms (and smart alarms) available on that app? Could you clarify what are SaA differentials?

    1. Hi Gabriel,
      if you want to use just smart alarm, then you’re good to use just Miband Tools. If you want sleep tracking, statistics, charts, goals, jet lag prevention, lullabies, sleep advices, noise recording, anti-snoring and other sleep-related functions, you need Sleep as Android.

  10. Hi there, and thanks for your ambitious work.

    Currently in SaA, when I try to enable heart rate monitoring and say OK to the BETA message, I get a blank page and a pop-up saying, “To view this content, please install and set up a web browsing app.”
    I’m using a Nexus 6P, Mi Band 2, SaA premium version 20170926, MiBandToos 3.5.1, Android 8.1.0, Chrome 63.0.3239.111.
    Any advice for getting heart rate monitoring to work?
    Thanks again!

  11. Hi,

    Recently, from time to time, heart rate data are only available for a part of the night time and then the red line becomes unavailable and no data are available anymore. What could be causing this?

  12. Thanks to both you and the mi band tools author! I bought a mi band expressly for this and so far have been mostly happy. Question: Are there any requirements for heart rate monitoring frequency or time periods? The first night I had mi band tools configured for 1 hour HR measurements 24 hrs / day. Sleep as An, pdroid worked perfectly, plotting heart rate and sleep.

    Then I went to 30 minute measurements for the 12 hours / day that covers sleeping. Sleep as Android no longer shows any heart rate information, though it is recorded as expected in mi band tools. Thoughts? Advice on how to fix? Was perfect the one time it worked …

    1. Not sure why it doesn’t work now — please send me a debug log (menu > report a bug).
      Regarding the best frequency, that would be at most 5 minutes to have accurate awake detection.

  13. Do you know what frequency for heart rate monitoring is best in Tools & Mi Band? I’m using 2 minutes, but not sure how that affects the battery or what the ideal settings from the Sleep as Android side is…

  14. Hi ! I have a Samsung J7 and a Miband 2. I did everything but alwasy when enter “Enable Sleep as Android > Settings > Wearables > Heart rate monitoring” it says “This feature is only available in the latest BETA version. BETA means more features but higher chance of bugs. Start receiving BETA versions from Play Store?”. Than when I click YES >>> it goes to a white screen, with the message “To view this content, install and configure a web browsing app”. When I click OK, it goes to the same white screen and nothing happens. How can I solve it ?

    Sleep as Android version > 20171223
    Android Version> 6.0.1
    mobile> Samsun Galaxy J7

    Lucas Moreira

  15. Hello Jiri. I just purchased the Mi Band 2. I live in the Caribbean island of Saint Lucia. I really want to monitor my sleep habits, but I can’t buy the highly rated Tools & Mi Band app in the Play Store because “it is not available in my country”.
    I can see that this app is heavily pirated as you pointed out, there are so many “cracked” versions out there.
    I would like to buy an official version of the app. How would you advise me to do that? I would be very grateful for your help. Thank you.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.