Integrate with GadgetBridge

From Mi1S on 2017/11/02 22:15:23 +0000

Right now you guys are using some proprietary and paid app to integrate Mi Bands and can’t even support 1S because you can’t access the heart rate.

The open source project gadget bridge: supports constant rate monitoring with the 1S and many devices already and is completely free. I do not use the Mi Fit app and so cannot use the wearable tracking whatsoever.

Since the app is open source you can submit a P/R to them and have support in the next version quite easily.

Copied from original feature request:

From Petr Nálevka on 2018/02/08 11:21:05 +0000

+Charis… sorry I missed the response was not from you…

Just to clarify, we do not support Tools & Mi Band, but Tools & Mi Band implemented support for our wearable API into Tools and any other Mi Band app can do the same thing.

So if my understanding it correct (I would need to check GadgetBridge implementation more to be sure here), but either we would need to integrate parts of Gadget Bridge into Sleep as Android which we cannot at the moment as GadgetBridge is under GPL and also it would not make any sense from a maintenance point of view as with any updates to GB we would need to integrate those etc…

So the obvious way to go would be support for our API which is really straight forward within GadgetBridge. That been said I think this feature request is on a wrong feature request forum.

From Chris on 2018/02/07 21:11:10 +0000

Hello Petr,
the comment from February 6th was not by me, although I do share the stated opinions.

Thank you for your honest and open communication, that's great! I understand that you have to prioritize user requests and that this topic is opening a task at a place that you see already covered.

And I understand that you are not really involved in this nor want to be. That's completely fine! Nobody wants you to take a public stance against Horak.

This request is just a wish of some of your faithful, paying customers to support another third-party app for a popular gadget. Because you are exactly right, these Xiaomi bands are the next best thing after the abandoned pebbles and cheap as well.

However privacy / data security is a real concern for me: I do not trust the Xiaomi app (and incidentally I do not see why I should trust this Horak app). And this is where GadgetBridge comes into play: It lets me use my mi band without leaking my sensitive health data to some third party in China or somewhere else, potentially selling it to my insurance company…

So please consider GadgetBridge support if user interest is raising further, I (and others) will definitely appreciate it!

From Petr Nálevka on 2018/02/06 12:55:31 +0000

Hello Chris, I'm not really involved in this matter and do not want to get involved.

According to what I know from Zdenek the screenshot story is completely made up, the real issue was a GadgetBridge team member posted part of Zdenek's decompiled code online and they did in fact encourage the community to decompile his app.

The real problem I see here is Xiaomi and their approach to make the protocol as closed as possible so that it is extremely hard to do any integrations. They did even break all integration efforts several times.

In this situation I would ideally suggest people to boycott such product (the Mi Band). But the reality is that after Pebble's fall there really isn't any proper wearable product on the market, so even I feel very bad about this I even started to recommend people the Mi Band because if Xiaomi breaks all integrations once again, at least they did not spend too much on the band and the battery really lasts…

Anyway as I said anyone can integrate any device with Sleep as Android using our APIs…

From Anonymous on 2018/02/06 08:30:12 +0000

Hello Petr,

even though Zdenek Horak and you may be of the oppinion that he owns the part of the code where he sniffed the BT connection to the MiBand this doesn't mean it's actually fact.
Fact is: anyone can sniff the BT connection of the mi band therefore no Third party developer can claim that it's his code. Xiaomi could maybe claim that, but that's another discussion.

plus: Instead of Zdenek Horak asking the devs to take down any stuff on github that was owned by him, he just filed a DCMA take down notice on the whole repository claiming that all of the code infringes his copyright. While the only thing that was maybe close to that claim where screenshots of his app that a user(!) posted there. He didn't even try to handle this in a more convenient way for everyone. His claim that he did this as a last resort is therefore false.

You are right, this isn't about free vs paid software. It's about a guy who wanted to rule out competition by abusing copyright law.

From Petr Nálevka on 2018/02/05 09:35:41 +0000

Hello Chris, many thanks for your opinion.

In fact I know Zdenek Horak and I know about that case. I was also asking him what happened?

He has assured me that he did that as a last resort action after GadgetBridge kept steeling his code from Tools & MiBand and made it public to be used by his competition.

In fact I can understand that BT sniffing requires an incredible amount of time and knowledge and he did put an immense effort into the app and of course I guess everyone wants to get payed for the job he is doing.

So IMHO this is not a free software vs. paid software dispute but something completely different.

Anyway we have an open API. So like Zdenek Horak utilized our API and implemented integration with Tools & Mi Band the Gadget Bridge team or even anyone else can do that same for Gadget Bridge…

The doc is here:

From Chris on 2018/02/03 15:44:30 +0000

Dear Petr, I am another happy user of Sleep as Android and I would strongly appreciate GadgetBridge support too!

Not only because it is better than the alternatives but because Zdenek Horka filed false accusations to take down GadgetBridge's github account.(see here

He is a liar and uses illegitimate actions against free software authors to push sales of his app.

I'm fine with paying for software generally, so I have paid money for Sleep as Android. But I really would hate to send this guy any money because for what he tried to do against the GadgedBridge people.

From Anonymous on 2018/01/30 09:33:35 +0000

Gadgetbridge supports both heart rate and accelerometer. Please implement this!

From Anonymous on 2018/01/28 21:03:10 +0000

Please make this happen, with the mi band we need 3 applications eating the phone battery for this to work, the mi band app, the mi tools and sleep as Android, I bought those two because I need it for waking on time for work and study and fee sleeping but it would be super cool if could just use GadgetBridge and Sleep as Android without all the constant battery draining from two extra applications waking my device with lot of wakelocks and alarms (because the mi band app sucks)

From Dominik on 2018/01/28 14:30:00 +0000

Hello Petr,
I think you could just ask the developers of Gadgetbridge if this is possible. I don't see a reason why they wouldn't expose the sensor data to a third party app, except for the work they would have to put into that. You can contact them via e-mail:
I would love to see this integrated into Sleep as Android.
Another option would maybe be to run the algorithms to determine sleep phases etc on the raw data (accelerometer and heart rate) which can be exported from gadgetbridge. Of course one would lose functionality like smart alarm but I think your algorithms are more accurate than the ones implemented directly into the mi band 2.
Kind Regards

From Anonymous on 2017/12/05 23:32:58 +0000

I would like this feature as well.

From Mi1S on 2017/11/03 16:07:20 +0000

It allows live heart rate. I get steps a minute live too. In the code:

private static void handleSensorData(byte[] value) {
int counter=0, step=0;
double xAxis=0.0, yAxis=0.0, zAxis=0.0;
double scale_factor = 1000.0;
double gravity = 9.81;

Looks like that is raw accelerometer data.

The “abandoned” Pebbles now may easily run on the brand new REBBLE OS, with more sophisticated features to come from the Rebble team. I signed in about 5 minutes after Rebble went live.

If anyone wants to “abandon” their Pebbles, some are going for $230 on Amazon. The rose gold PTR is especially expensive and desired. But you’d be unwise to get rid of something that STILL WORKS GREAT! If you want a new Pebble of any kind, you’d better hurry because the hardware is flying out of stores, both online and brick&mortar. It was THE tech story over the weekend. I originally bought a Pebble FOR Sleep As Android. It’s still the best.

I don’t want the problems I keep hearing about MiBands. For HR, I use a forearm band that takes continuous readings several times PER SECOND. I chose the Scocshe Rhythm 24 because of its very long battery life. Polar and Wahoo both have similar devices, but the Scosche generally has been tested to have greater accuracy.

The only component I am missing is Sp02.

#pebblelives #rebble #lovemypebble


BTW, when I tested the Mi Band 2 in this set-up, my phone battery drained quickly while plugged in. I took both apps off my phone and charging commenced immediately. This was last year. I put it in a drawer in case Pebble was not saved. Pebble just got saved! And I have a wonderful HR monitor because I use Pebble for actiography.


Are there any chances of working with Gadgetbridge? I do have “Notify for” but it still requires zapp app (which is awful…)