Mi band 1S heartbeat live monitoring #178

Closed
by boogerlad opened 6 years ago · 72 comments
boogerlad commented 6 years ago (Migrated from github.com)
Owner

This feature isn't implemented yet. In the mi fit app, I took a bluetooth trace of it while it was measuring my heart beat.

6274 736e 6f6f 7000 0000 0001 0000 03ea
0000 000f 0000 000f 0000 0000 0000 0000
00e2 0365 dc2c 57e4 0240 000a 0006 0004
0012 4e00 1502 0100 0000 0800 0000 0800
0000 0300 0000 0000 e203 65dc 3034 7c04
1305 0140 0001 0000 0000 0a00 0000 0a00
0000 0100 0000 0000 e203 65dc 4004 ee02
4020 0500 0100 0400 1300 0000 0e00 0000
0e00 0000 0100 0000 0000 e203 65dc c4f0
ff02 4020 0900 0500 0400 1b4b 0006 46
This feature isn't implemented yet. In the mi fit app, I took a bluetooth trace of it while it was measuring my heart beat. <pre>6274 736e 6f6f 7000 0000 0001 0000 03ea 0000 000f 0000 000f 0000 0000 0000 0000 00e2 0365 dc2c 57e4 0240 000a 0006 0004 0012 4e00 1502 0100 0000 0800 0000 0800 0000 0300 0000 0000 e203 65dc 3034 7c04 1305 0140 0001 0000 0000 0a00 0000 0a00 0000 0100 0000 0000 e203 65dc 4004 ee02 4020 0500 0100 0400 1300 0000 0e00 0000 0e00 0000 0100 0000 0000 e203 65dc c4f0 ff02 4020 0900 0500 0400 1b4b 0006 46</pre>
Owner

Thanks! I didn't check yet, but I hope the Mi Band uses the standard bluetooth LE heart rate profile (http://developer.bluetooth.org/TechnologyOverview/Documents/HRP_SPEC.pdf).

Thanks! I didn't check yet, but I hope the Mi Band uses the standard bluetooth LE heart rate profile (http://developer.bluetooth.org/TechnologyOverview/Documents/HRP_SPEC.pdf).
boogerlad commented 6 years ago (Migrated from github.com)
Poster
Owner

Let me know what tests you want me to do to assist you.

Let me know what tests you want me to do to assist you.
Owner

Will do. Might take a little while, though.

Will do. Might take a little while, though.
omairaslam commented 6 years ago (Migrated from github.com)
Owner

Does the code work with Mi Band 1S for the other features ?

Does the code work with Mi Band 1S for the other features ?
Owner

@omairaslam
We do not know, since no one of us own a Mi Band 1S (yet?)

@omairaslam We do not know, since no one of us own a Mi Band 1S (yet?)
Owner

Anybody out there who owns a model 1S? Please test with Gadgetbridge and report any issues!

Anybody out there who owns a model 1S? Please test with Gadgetbridge and report any issues!
Owner

Related: #162

Related: #162
bymodude commented 6 years ago (Migrated from github.com)
Owner

Im trying to connect MI1S in Gadgetbridge it says connecting, initialized, connected and then "not connected" again, so basically cant connect

attached is a logcat output
1slogcat.txt

Im trying to connect MI1S in Gadgetbridge it says connecting, initialized, connected and then "not connected" again, so basically cant connect attached is a logcat output [1slogcat.txt](https://github.com/Freeyourgadget/Gadgetbridge/files/55676/1slogcat.txt)
Owner

Thanks for the log, will have a look later in the evening.

Thanks for the log, will have a look later in the evening.
Owner

FWIW, 0.6.9 is released with the above fix.I hope/think this will fix your connection problems. I'm afraid that notifications upon received sms, chat messages, etc. will not work, though (you can try them in the Debug screen).

It looks like the notification API has changed again in current Mi Band firmwares and we have to adjust to that. Notifications might still work with the firmware from Mi Fit 1.5.912-1539.

FWIW, 0.6.9 is released with the above fix.I hope/think this will fix your connection problems. I'm afraid that notifications upon received sms, chat messages, etc. will not work, though (you can try them in the Debug screen). It looks like the notification API has changed again in current Mi Band firmwares and we have to adjust to that. Notifications might still work with the firmware from Mi Fit 1.5.912-1539.
bymodude commented 6 years ago (Migrated from github.com)
Owner

thanks for the prompt fix! however I tried it with 0.6.9 and still having the same problems, logcat attached
1s_logcat_069.txt

thanks for the prompt fix! however I tried it with 0.6.9 and still having the same problems, logcat attached [1s_logcat_069.txt](https://github.com/Freeyourgadget/Gadgetbridge/files/56223/1s_logcat_069.txt)
bymodude commented 6 years ago (Migrated from github.com)
Owner

Thanks, this commit indeed makes it work, the MI1S successfully connects and shows battery percentage, however after 10 or 15 seconds it always disconnects, is this expected?
When I go to Debug / "send as SMS" the 1S is vibrating 3 times so that seems to work

I am mostly interested into accessing the heart rate sensor as well, would be great if that can be added to gadgetbridge!

Thanks, this commit indeed makes it work, the MI1S successfully connects and shows battery percentage, however after 10 or 15 seconds it always disconnects, is this expected? When I go to Debug / "send as SMS" the 1S is vibrating 3 times so that seems to work I am mostly interested into accessing the heart rate sensor as well, would be great if that can be added to gadgetbridge!
Owner

No, this is not expected. It might be due to a bad bluetooth stack on the mobile, bad firmware on the Mi Band or due to us doing something (or not doing something).

Could you attach another log including the disconnect? BTW, there is also a log option in Gadgetbridge's preferences, which will save the log to a file. It will only contain Gadgetbridge's log statements, though.

Regarding the heart rate sensor: could you try to find out whether the Mi Band supports the standardized bluetooth heart rate profile? Google's BLE Sample app ( https://github.com/googlesamples/android-BluetoothLeGatt) or the modified version (https://github.com/movisens/android-SmartGattLib-Example) should provide this information for example.

If the standard profile is used, we could add support for it without actually having a device to test against.

No, this is not expected. It might be due to a bad bluetooth stack on the mobile, bad firmware on the Mi Band or due to us doing something (or not doing something). Could you attach another log including the disconnect? BTW, there is also a log option in Gadgetbridge's preferences, which will save the log to a file. It will only contain Gadgetbridge's log statements, though. Regarding the heart rate sensor: could you try to find out whether the Mi Band supports the standardized bluetooth heart rate profile? Google's BLE Sample app ( https://github.com/googlesamples/android-BluetoothLeGatt) or the modified version (https://github.com/movisens/android-SmartGattLib-Example) should provide this information for example. If the standard profile is used, we could add support for it without actually having a device to test against.
tapir commented 6 years ago (Migrated from github.com)
Owner

I will receive my 1S in a week or so. Hopefully I will be of help to reverse engineer this thing.

I will receive my 1S in a week or so. Hopefully I will be of help to reverse engineer this thing.
Owner

Cool, looking forward to that :-)

Cool, looking forward to that :-)
KashaMalaga commented 6 years ago (Migrated from github.com)
Owner

Hello, Im here to help, i´ve got the 1S and checking how its working ;)
logINFO1S.txt

Hello, Im here to help, i´ve got the 1S and checking how its working ;) [logINFO1S.txt](https://github.com/Freeyourgadget/Gadgetbridge/files/68407/asd.txt)
tapir commented 6 years ago (Migrated from github.com)
Owner

Got my 1S. I'll try to fiddle with it for a while

Got my 1S. I'll try to fiddle with it for a while
Owner

Great, let us know how it works out!

Great, let us know how it works out!
Owner

@KashaMalaga Would you like to clone our repo so that we can work together on supporting the heartrate sensor?

@KashaMalaga Would you like to clone our repo so that we can work together on supporting the heartrate sensor?
KashaMalaga commented 6 years ago (Migrated from github.com)
Owner

Ofc i could help over here!!
Going to clone and start digging into your project 👍

Obviously Xiaomi doesnt share the complete BLE stack for HR measuring so isnt working with all those common apps to measure HR.

I´ve found 3 diferent modes to read:
UUID: 2a39 to read
UUID: 2a37 onNotify/SR
parameters:
SLEEP((byte) 0),
// Takes random HR data at night and when you get up to modify Sleep deep duration, etc.
CONTINUOUS((byte) 1),
// Its used in running mode, thats the interesting part (Battery less than 3 days ...)
MANUAL((byte) 2);
//This one is the known mode from the Xiaomi app, dont like it cause with just a few reads ..if you are moving or in a bad position, +160bpm ...

That's a resume about my short search

Ofc i could help over here!! Going to clone and start digging into your project :+1: Obviously Xiaomi doesnt share the complete BLE stack for HR measuring so isnt working with all those common apps to measure HR. I´ve found 3 diferent modes to read: UUID: 2a39 to read UUID: 2a37 onNotify/SR parameters: SLEEP((byte) 0), // Takes random HR data at night and when you get up to modify Sleep deep duration, etc. CONTINUOUS((byte) 1), // Its used in running mode, thats the interesting part (Battery less than 3 days ...) MANUAL((byte) 2); //This one is the known mode from the Xiaomi app, dont like it cause with just a few reads ..if you are moving or in a bad position, +160bpm ... That's a resume about my short search
rs9000 commented 6 years ago (Migrated from github.com)
Owner

UUID: 2a39 is Heart Rate Control Point (read/write)
and
UUID: 2a37 is Heart Rate Measurement (notify only)
So data are stored in 2a37 but this address is inaccessible and gattlib return me this error
"Read characteristics by UUID failed: Attribute can't be read".
How can I turn on sensor and read bpm?

UUID: 2a39 is Heart Rate Control Point (read/write) and UUID: 2a37 is Heart Rate Measurement (notify only) So data are stored in 2a37 but this address is inaccessible and gattlib return me this error "Read characteristics by UUID failed: Attribute can't be read". How can I turn on sensor and read bpm?
Owner

you can try like this:
-register the notification on the notify endpoint (see in mibandsupport for other characteristics where we do the same), then you need to modify oncharacteristicchanged to deal with the notifications on this characteristic, you can use logmessagecontent as handler at the beginning (it just logs to logcat)
-activate the hr readings by writing to the hr control characteristic
-profit? :)

I'm from mobile, so it may be that some directions aren't 100% correct, but should help you getting started!

you can try like this: -register the notification on the notify endpoint (see in mibandsupport for other characteristics where we do the same), then you need to modify oncharacteristicchanged to deal with the notifications on this characteristic, you can use logmessagecontent as handler at the beginning (it just logs to logcat) -activate the hr readings by writing to the hr control characteristic -profit? :) I'm from mobile, so it may be that some directions aren't 100% correct, but should help you getting started!
rs9000 commented 6 years ago (Migrated from github.com)
Owner

I would activate hr readings, but what should I write in what address?
I understand that:
handle: 0x0049, uuid: 2800 value: 0d18 (HR service)
handle: 0x004a, uuid: 2803 value: 10 (options) 4b00 (hnd) 372a (uuid)
handle: 0x004b, uuid: 2a37 (HR Measuremnet) value: unaccessible
handle: 0x004c, uuid: 2902 value: blank
handle: 0x004d, uuid: 2803 value: 0a (options) 4e00 (hnd) 392a (uuid)
handle: 0x004e, uuid: 2a39 (HR Control point) value: 00 00

So I tried to write in uuid 2803 the value 0a4b00372a but it is read-only

I would activate hr readings, but what should I write in what address? I understand that: handle: 0x0049, uuid: 2800 value: 0d18 (HR service) handle: 0x004a, uuid: 2803 value: 10 (options) 4b00 (hnd) 372a (uuid) handle: 0x004b, uuid: 2a37 (HR Measuremnet) value: unaccessible handle: 0x004c, uuid: 2902 value: blank handle: 0x004d, uuid: 2803 value: 0a (options) 4e00 (hnd) 392a (uuid) handle: 0x004e, uuid: 2a39 (HR Control point) value: 00 00 So I tried to write in uuid 2803 the value 0a4b00372a but it is read-only
KashaMalaga commented 6 years ago (Migrated from github.com)
Owner

Dont have a real Android device to test, just trying under vm+ble and emu :(
Could someone check my version in my repo?? Since Dec 28
Couldnt sync any band, 1,1A or 1S always trying to connect and no messages (or vmware just keep on trolling me)

Dont have a real Android device to test, just trying under vm+ble and emu :( Could someone check my version in my repo?? Since Dec 28 Couldnt sync any band, 1,1A or 1S always trying to connect and no messages (or vmware just keep on trolling me)
Owner

@KashaMalaga Great work! At a first glance, your commits look perfect, there's no reason why connecting shouldn't work anymore. I'll have a closer look to check if I missed something.

@KashaMalaga Great work! At a first glance, your commits look perfect, there's no reason why connecting shouldn't work anymore. I'll have a closer look to check if I missed something.
Owner

One thing I noticed is that you probably need to register for notifications on the HEART_RATE_MEASUREMENT characteristic (see MiBandSupport#enableNotifications(TransactionBuilder, boolean)).

I still don't know where the connection problems could stem from.

One thing I noticed is that you probably need to register for notifications on the HEART_RATE_MEASUREMENT characteristic (see MiBandSupport#enableNotifications(TransactionBuilder, boolean)). I still don't know where the connection problems could stem from.
Owner

@KashaMalaga where you added try-catch blocks around statements -- did you actually experience exceptions there?

@KashaMalaga where you added try-catch blocks around statements -- did you actually experience exceptions there?
KashaMalaga commented 6 years ago (Migrated from github.com)
Owner

sure, im running under android emu (haxm 6.0) and in a tablet with 4.4, no other android phone devices to dev right now, waiting my Note2 until returns from vacations.

Edit: The problem here, couldnt pair any band, so couldnt test HR button .. i think that the last update with FW 4.15.11.20 for 1S and FW 1.0.11.7 for the 1 model broke the pair system, at least here. Anyone with theses versions could deny this?

sure, im running under android emu (haxm 6.0) and in a tablet with 4.4, no other android phone devices to dev right now, waiting my Note2 until returns from vacations. Edit: The problem here, couldnt pair any band, so couldnt test HR button .. i think that the last update with FW 4.15.11.20 for 1S and FW 1.0.11.7 for the 1 model broke the pair system, at least here. Anyone with theses versions could deny this?
Owner

Alright -- if you still have exceptions in your log, please post them here; maybe we should handle them differently than just logging + continue.

Alright -- if you still have exceptions in your log, please post them here; maybe we should handle them differently than just logging + continue.
Owner

Oh, why did you add the LOCATION permissions? I don't think we need them anywhere!?

Oh, why did you add the LOCATION permissions? I don't think we need them anywhere!?
Owner

@KashaMalaga Oh, and great research already! :-)

@KashaMalaga Oh, and great research already! :-)
KashaMalaga commented 6 years ago (Migrated from github.com)
Owner

In android 6 its needed to search under BLE 👍

http://developer.radiusnetworks.com/2015/09/29/is-your-beacon-app-ready-for-android-6.html

E BluetoothUtils: Permission denial: Need ACCESS_COARSE_LOCATION or
ACCESS_FINE_LOCATION permission to get scan results

PS. Ok going to give some extra info about those crash

In android 6 its needed to search under BLE :+1: http://developer.radiusnetworks.com/2015/09/29/is-your-beacon-app-ready-for-android-6.html E BluetoothUtils: Permission denial: Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission to get scan results PS. Ok going to give some extra info about those crash
Owner

as far as I understand it's needed for bt scan in background, which I don't think we are doing/need to do.

as far as I understand it's needed for bt scan in background, which I don't think we are doing/need to do.
KashaMalaga commented 6 years ago (Migrated from github.com)
Owner

When i started my fork, just running current version gives this permission exception, im the only one using AE 2 with the new emu? its blazing

When i started my fork, just running current version gives this permission exception, im the only one using AE 2 with the new emu? its blazing
Owner

I'm not using Android studio 2 but I'll try it if you deem it worthwhile (especially since 1.5 gives me debugging issues).

As for the permission error I had no doubt that you added the permission because it was asked by the system, what I meant is that I'd very much prefer to remove the requirement for it (eg by doing the discovery in a different way) instead of adding it 😃

I'm not using Android studio 2 but I'll try it if you deem it worthwhile (especially since 1.5 gives me debugging issues). As for the permission error I had no doubt that you added the permission because it was asked by the system, what I meant is that I'd very much prefer to remove the requirement for it (eg by doing the discovery in a different way) instead of adding it 😃
KashaMalaga commented 6 years ago (Migrated from github.com)
Owner

Ofc im agree with that idea, location its a dumb permission, dont look if could be another way to do it.
Regards and happy new year's eve

Ofc im agree with that idea, location its a dumb permission, dont look if could be another way to do it. Regards and happy new year's eve
KashaMalaga commented 6 years ago (Migrated from github.com)
Owner

log_filter_nodomain.freeyourgadget.gadgetbridge.txt
log_filter_BT.txt
log_error_bluetooth_startLeScan.txt

Tested with 3 bands, 1 and 1S infinite trying to pair without any sign in theses bands ( are free and unpaired and without miFit installed ).

PS. another error found comes when the own the device is searching, so the app could start the search.
01-02 13:27:55.228: I/nodomain.freeyourgadget.gadgetbridge.activities.DiscoveryActivity(17650): Starting BTLE Discovery
01-02 13:27:55.238: D/BluetoothAdapter(17650): startLeScan(): null
01-02 13:27:55.238: E/BluetoothAdapter(17650): LE Scan has already started

[log_filter_nodomain.freeyourgadget.gadgetbridge.txt](https://github.com/Freeyourgadget/Gadgetbridge/files/76223/log_filter_nodomain.freeyourgadget.gadgetbridge.txt) [log_filter_BT.txt](https://github.com/Freeyourgadget/Gadgetbridge/files/76224/log_filter_BT.txt) [log_error_bluetooth_startLeScan.txt](https://github.com/Freeyourgadget/Gadgetbridge/files/76225/log_error_bluetooth_startLeScan.txt) Tested with 3 bands, 1 and 1S infinite trying to pair without any sign in theses bands ( are free and unpaired and without miFit installed ). PS. another error found comes when the own the device is searching, so the app could start the search. 01-02 13:27:55.228: I/nodomain.freeyourgadget.gadgetbridge.activities.DiscoveryActivity(17650): Starting BTLE Discovery 01-02 13:27:55.238: D/BluetoothAdapter(17650): startLeScan(): null 01-02 13:27:55.238: E/BluetoothAdapter(17650): LE Scan has already started
zimonth commented 6 years ago (Migrated from github.com)
Owner

Just a note related to this.
I got MI1S last week and I cannot connect it to Gadgetbridge (GB) normally. I've tried with v 0.6.9 and with v0.7.0

The firmware of MI1S is "HW: 1S FW: 4.15.11.20"

I also have MI1A which has worked with GB.
When I go to GB/"Connect New Device", it always finds just MI1A and not MI1S. And I have checked "Mi Fit" is not running in background.

If I go to GB settings/"Mi Band Settings" and put in the correct "Mi Band address" of the MI1S, then now with v0.7.0 GB can find the band. The band is then recognized but named just as "MI", not "MI1S" as "MI1A" is.

When trying to synchronize, fails with: "Gadgetbridge: Data transfer failed"

Edited later:
[Was]
I have "Write Log Files" enabled and GB is restarted but somehow there is no any "gadgetbridge" directory in /mnt/sdcard/Android/data/ so where does the log files go then?

There was a directory for gadgetbridge before, but I uninstalled app and re-installed, and now it does not have that directory in /mnt/sdcard/Android/data/ anymore.
[/Was]

I connected GB to MI1A, and then it created that /mnt/sdcard/Android/data/nodomain.freeyourgadget.gadgetbridge/ directory again, and /files/gadgetbridge.log is there.

So with MI1S GB is so incompatible it does not get to that stage it would create gadgetbridge.log file.

There is many Java NullPointerExecptions in the gadgetbridge.log file, which is attached.
In the log file, first I have connected to MI1A, but then later always just trying to connect to MI1S and if successful, then trying to synchronize. Synchronizing sometimes starts, but claims it gets more data what was asked.

gadgetbridge.log.zip

Just a note related to this. I got MI1S last week and I cannot connect it to Gadgetbridge (GB) normally. I've tried with v 0.6.9 and with v0.7.0 The firmware of MI1S is "HW: 1S FW: 4.15.11.20" I also have MI1A which has worked with GB. When I go to GB/"Connect New Device", it always finds just MI1A and not MI1S. And I have checked "Mi Fit" is not running in background. If I go to GB settings/"Mi Band Settings" and put in the correct "Mi Band address" of the MI1S, then now with v0.7.0 GB can find the band. The band is then recognized but named just as "MI", not "MI1S" as "MI1A" is. When trying to synchronize, fails with: "Gadgetbridge: Data transfer failed" Edited later: [Was] I have "Write Log Files" enabled and GB is restarted but somehow there is no any "gadgetbridge" directory in /mnt/sdcard/Android/data/ so where does the log files go then? There was a directory for gadgetbridge before, but I uninstalled app and re-installed, and now it does not have that directory in /mnt/sdcard/Android/data/ anymore. [/Was] I connected GB to MI1A, and then it created that /mnt/sdcard/Android/data/nodomain.freeyourgadget.gadgetbridge/ directory again, and /files/gadgetbridge.log is there. So with MI1S GB is so incompatible it does not get to that stage it would create gadgetbridge.log file. There is many Java NullPointerExecptions in the gadgetbridge.log file, which is attached. In the log file, first I have connected to MI1A, but then later always just trying to connect to MI1S and if successful, then trying to synchronize. Synchronizing sometimes starts, but claims it gets more data what was asked. [gadgetbridge.log.zip](https://github.com/Freeyourgadget/Gadgetbridge/files/76599/gadgetbridge.log.zip)
Owner

Thanks for the logs and all your useful input -- I will have a look at all this tomorrow evening.

Thanks for the logs and all your useful input -- I will have a look at all this tomorrow evening.
Owner

@zimonish regarding the missing gadgetbridge directory -- did you re-enable the "Write Log Files" option after reinstlaling Gadgetbridge? The directory should be created right on startup (after enabling the option and restarting gadgetbridge) and it really is independent of the Mi Band model.

@zimonish regarding the missing gadgetbridge directory -- did you re-enable the "Write Log Files" option after reinstlaling Gadgetbridge? The directory should be created right on startup (after enabling the option and restarting gadgetbridge) and it really is independent of the Mi Band model.
zimonth commented 6 years ago (Migrated from github.com)
Owner

I do not remember if I needed to re-enable "Write Log Files" or was it already there after re-installing GB.

I also found it strange after removing GB installation and then re-installing it did not create that GB data directory in .../Android/... and even when trying to use GB with Mi1S it did not create it. Only after I connected to Mi1A it did create that directory. I can of course try to repeat the behaviour by removing and re-installing once again.

I do not remember if I needed to re-enable "Write Log Files" or was it already there after re-installing GB. I also found it strange after removing GB installation and then re-installing it did not create that GB data directory in .../Android/... and even when trying to use GB with Mi1S it did not create it. Only after I connected to Mi1A it did create that directory. I can of course try to repeat the behaviour by removing and re-installing once again.
Owner

Preferences are also deleted when uninstalling.

Maybe your SD card was unmounted on startup so that Gadgetbridge simply could not create the directory? But if we want to debug this further, we need to open a separate ticket for this.

Preferences are also deleted when uninstalling. Maybe your SD card was unmounted on startup so that Gadgetbridge simply could not create the directory? But if we want to debug this further, we need to open a separate ticket for this.
langovoi commented 6 years ago (Migrated from github.com)
Owner

Any news about work with heart rate senser?

Any news about work with heart rate senser?
Owner

I haven't had time to look into this yet, sorry. I also still lack a 1S device.

I haven't had time to look into this yet, sorry. I also still lack a 1S device.
KashaMalaga commented 6 years ago (Migrated from github.com)
Owner

screenshot_2016-01-14-08-39-15 test from last night using 10minutes measures
accomplished first by someone else
https://goo.gl/2uGrBR

I made some mistakes in my interpretation, sorry about that but only have an old tablet with Android :-/

![screenshot_2016-01-14-08-39-15](https://cloud.githubusercontent.com/assets/879449/12333452/992b97a8-baf4-11e5-8296-c6134f71890a.png) test from last night using 10minutes measures accomplished first by someone else https://goo.gl/2uGrBR I made some mistakes in my interpretation, sorry about that but only have an old tablet with Android :-/
langovoi commented 6 years ago (Migrated from github.com)
Owner

@KashaMalaga how you get data?

@KashaMalaga how you get data?
rs9000 commented 6 years ago (Migrated from github.com)
Owner

@KashaMalaga any news how this app get data?

@KashaMalaga any news how this app get data?
Samarium151 commented 6 years ago (Migrated from github.com)
Owner

Tried on phone running android 5.1 and tablet running 4.4.2
MI 1s FW 4.14.11.19 Gadgetbridge 0.7.4 Mi fit is not installed (and never was on tablet)

Band recognized. Test sms etc in debug works fine. Locate device etc fine.

Same errors on both when trying to sync data: error buffering activity data remaining bytes: 5 received: 20

No data populates in your activity. quit and reloaded a few times. Added non-default biometric data because of some of what's in the log. No change in errors. Also took me multiple quit lauch cycles before it would generate log.

Log has file has multiple attempts.

gadgetbridge.txt

Tried on phone running android 5.1 and tablet running 4.4.2 MI 1s FW 4.14.11.19 Gadgetbridge 0.7.4 Mi fit is not installed (and never was on tablet) Band recognized. Test sms etc in debug works fine. Locate device etc fine. Same errors on both when trying to sync data: error buffering activity data remaining bytes: 5 received: 20 No data populates in your activity. quit and reloaded a few times. Added non-default biometric data because of some of what's in the log. No change in errors. Also took me multiple quit lauch cycles before it would generate log. Log has file has multiple attempts. [gadgetbridge.txt](https://github.com/Freeyourgadget/Gadgetbridge/files/125845/gadgetbridge.txt)
fgnm commented 6 years ago (Migrated from github.com)
Owner

Hello here is the solution to access heart rate sensor :)
https://github.com/pangliang/miband-sdk-android

I know comments are in Chinese but with google translate is not so difficult to understand

Hello here is the solution to access heart rate sensor :) https://github.com/pangliang/miband-sdk-android I know comments are in Chinese but with google translate is not so difficult to understand
Owner

I still haven't received my 1S, but I'll try to add some support for the heart rate sensor ASAP.

I still haven't received my 1S, but I'll try to add some support for the heart rate sensor ASAP.
zimonth commented 6 years ago (Migrated from github.com)
Owner

Recently I was able to get SportsTrackLive (STL) to support Mi1S with these instructions:
https://getsatisfaction.com/sportstracklive/topics/mi-band-with-hr-sensor-and-bt4-ble-not-working
So the latest Mi Fit version supports continuing HR monitoring during an exercise. Having that ON, and starting SportsTrackLive, also STL was able to read HR monitoring and record an exercise.

Recently I was able to get SportsTrackLive (STL) to support Mi1S with these instructions: https://getsatisfaction.com/sportstracklive/topics/mi-band-with-hr-sensor-and-bt4-ble-not-working So the latest Mi Fit version supports continuing HR monitoring during an exercise. Having that ON, and starting SportsTrackLive, also STL was able to read HR monitoring and record an exercise.
Owner

I cherry-picked and @KashaMalaga's commits locally and enabled heart rate measurement for sleep mode. Let's see how it looks, tomorrow :-)

I cherry-picked and @KashaMalaga's commits locally and enabled heart rate measurement for sleep mode. Let's see how it looks, tomorrow :-)
Owner

I can enable heart rate scanning, the green LEDs light up (at least once), but the rate we receive is always 0. FWIW, I get the same result with miband-sdk-android. Needs some more digging, I guess.

I can enable heart rate scanning, the green LEDs light up (at least once), but the rate we receive is always 0. FWIW, I get the same result with miband-sdk-android. Needs some more digging, I guess.
Owner

I just pushed the changes so that you guys can try it, too. The Debug screen has a new button "HR Rate Test", which you can press. Then you should get some log output, in logcat and the logfile about the heart rate measurement results.

I just pushed the changes so that you guys can try it, too. The Debug screen has a new button "HR Rate Test", which you can press. Then you should get some log output, in logcat and the logfile about the heart rate measurement results.
Owner

I just pushed another change. Please use the Debug activity and press the "Heart Rate Test" button. This will cause a "manual" heart rate measurement, which takes about 4-5 seconds. The result will be displayed as a short popup (toast).

Please test this if you can and report back if you get any meaningful value.

I only get 0 as value ;(

I just pushed another change. Please use the Debug activity and press the "Heart Rate Test" button. This will cause a "manual" heart rate measurement, which takes about 4-5 seconds. The result will be displayed as a short popup (toast). Please test this if you can and report back if you get any meaningful value. I only get 0 as value ;(
Owner

@Samarium151 and everybody else: we will release 0.8.1 tomorrow, so you can test whether heart rate reading works.

@Samarium151 and everybody else: we will release 0.8.1 tomorrow, so you can test whether heart rate reading works.
danielfh commented 5 years ago (Migrated from github.com)
Owner

@cpfeiffer I can confirm you that heart rate reading is working! Thank you :-)

FW: 4.15.12.10
HR: 1.3.74.64

@cpfeiffer I can confirm you that heart rate reading is working! Thank you :-) FW: 4.15.12.10 HR: 1.3.74.64
Owner

Great, thanks a lot for testing! Then we can gradually make more interesting features available, than just the button in the Debug screen :-)

Great, thanks a lot for testing! Then we can gradually make more interesting features available, than just the button in the Debug screen :-)
gume commented 5 years ago (Migrated from github.com)
Owner

Thank you! Heart Rate Test works, I can confirm! FW: 4.15.11.20 ☺️

Thank you! Heart Rate Test works, I can confirm! FW: 4.15.11.20 ☺️
ragesoss commented 5 years ago (Migrated from github.com)
Owner

Heart rate test works for me as well! Would love to be able to put it in continuous mode and download that data.

Heart rate test works for me as well! Would love to be able to put it in continuous mode and download that data.
Owner

@ragesoss Yes, that's the plan!

We already get heart rate data together with activity data when the band is in such a mode, and there's already some (currently disabled) code, that displays a curve of it.

Just takes some more time and love. Of well, and it would help if my band would produce other hr values than 0.

@ragesoss Yes, that's the plan! We already get heart rate data together with activity data when the band is in such a mode, and there's already some (currently disabled) code, that displays a curve of it. Just takes some more time and love. Of well, and it would help if my band would produce other hr values than 0.
gume commented 5 years ago (Migrated from github.com)
Owner

Recently I received a new band from China. The heart rate was 0. I updated the firmware (I think there was no firmware on it) and now it displays the heart rate (not 0). I hope it will help you as well.

Recently I received a new band from China. The heart rate was 0. I updated the firmware (I think there was no firmware on it) and now it displays the heart rate (not 0). I hope it will help you as well.
Owner

@gume Thanks for the encouragement, much appreciated :-) Will continue work on firmware update ASAP. Fingers crossed!

@gume Thanks for the encouragement, much appreciated :-) Will continue work on firmware update ASAP. Fingers crossed!
wanderer commented 5 years ago (Migrated from github.com)
Owner

@gume how did you update the firmware?

@gume how did you update the firmware?
bigretromike commented 5 years ago (Migrated from github.com)
Owner

HW: 1S FW: 4.15.12.10 I'm not sure how to check HR firmware version.
Debug: Heart Rate test - works fine

HW: 1S FW: 4.15.12.10 I'm not sure how to check HR firmware version. Debug: Heart Rate test - works fine
sachinnair92 commented 5 years ago (Migrated from github.com)
Owner

@bigretromike How did you manage to fetch the heart rate. Can you give any Instruction / code to do so.

@bigretromike How did you manage to fetch the heart rate. Can you give any Instruction / code to do so.
bigretromike commented 5 years ago (Migrated from github.com)
Owner

sure @sachinnair92, Gadgetbridge, click on band to connect to it (but done eneter it) click tree dots on right ...
debug, and test heart rate . and got 72 ~ which is what mi fit showed before clean format ;-)

sure @sachinnair92, Gadgetbridge, click on band to connect to it (but done eneter it) click tree dots on right ... debug, and test heart rate . and got 72 ~ which is what mi fit showed before clean format ;-)
sachinnair92 commented 5 years ago (Migrated from github.com)
Owner

@bigretromike Thanks for the reply... Did you flash the Mi 1S band with any firmware or you used the default one ?

@bigretromike Thanks for the reply... Did you flash the Mi 1S band with any firmware or you used the default one ?
bigretromike commented 5 years ago (Migrated from github.com)
Owner

@sachinnair92, I only used the one from newest Mi Fit. FW: 4.15.12.10
I stoped using mi fit 2 days ago. Testing this one after I saw that there is semi support for 1S ;-) which is experimental, but I probably switch to something with data sync to 3rd party sites to keep all data in one place ;-)

@sachinnair92, I only used the one from newest Mi Fit. FW: 4.15.12.10 I stoped using mi fit 2 days ago. Testing this one after I saw that there is semi support for 1S ;-) which is experimental, but I probably switch to something with data sync to 3rd party sites to keep all data in one place ;-)
Owner

Hooray, after updating the hr firmware via #234, I finally have a heartbeat :-)
So there is progress!

@sachinnair92 At the moment there is just a simple "Heart rate test" button in the Debug activity.. Press the button, wait a bit and you will get a toast with the measured value.

Hooray, after updating the hr firmware via #234, I finally have a heartbeat :-) So there is progress! @sachinnair92 At the moment there is just a simple "Heart rate test" button in the Debug activity.. Press the button, wait a bit and you will get a toast with the measured value.
bigretromike commented 5 years ago (Migrated from github.com)
Owner

@cpfeiffer glad to hear that! ;-) I thing most if not everything (i cannot test all of them because dont know how) buttons in Debug menu work for 1S ! 👍 which is good.
Only problem now for me is the initiation bug: https://github.com/Freeyourgadget/Gadgetbridge/issues/249

@cpfeiffer glad to hear that! ;-) I thing most if not everything (i cannot test all of them because dont know how) buttons in Debug menu work for 1S ! :+1: which is good. Only problem now for me is the initiation bug: https://github.com/Freeyourgadget/Gadgetbridge/issues/249
Owner

I'm going to close this one, as live monitoring is already available. I'll open another issue to gather all sorts of improvements/new features related to heart rate measurements.

I'm going to close this one, as live monitoring is already available. I'll open another issue to gather all sorts of improvements/new features related to heart rate measurements.
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.