yashsingh1/xdaforums huggingface dataset:
[General Accessories] mibanddd:
Still works for me, also for version 3.x of Mi fit and of course for Mi Band 2. What is your method of getting access to the database files? Of course you need the origin db file, for example it can have a name like origin_db_6d91c62551b4689d1d897d7250f9b671 and is in the internal android folder /data/data/com.xiaomi.hm.health/databases .

The newest version of the Mi Band extract tool (on page 12, first post #271) only works with rooted Android phones with working adb drivers for your phone installed on your PC.

Also, file names for the origin db file changed again. Now it is much longer. Using the profile id will not work. You have to look at the new file name and change the set origin_db= to the correct file name.

Note that for non-rooted phones, the old backup method does not work with the new version. We have to wait for an updated backup-friendly app like this by Alex https://xdaforums.com/showpost.php?p=69133139&postcount=266 and then I can update the script so that it includes the backup procedure.

If you are able to copy the database files from your rooted android but somehow the adb procedure is not working, I can help you. Just copy the origin_db_... file to subfolder "temp" and change the following lines in the extract_data.bat by inserting "rem" at the start of the two lines (highlighted in bold here):

rem rmdir /S /Q temp > nul

rem rmdir /S /Q %DLPath% > nul

By the way, the new raw data extraction script takes quite a long time. I've just tested it with an origin db file of 2-3 MB (representing a period of 9 months) which ran up to 10-11 MB during raw data extraction, taking around 15 minutes in total. In the next version of the script I will include a progress display.

Note: You surely need to give some more information on how you do this and where something goes wrong if you want us to be able to help you...
[General Accessories] zlikovac:
On iOS Mi Fit 3.x Xiaomi stopped using sqllite as db. They switched to realm db. Anyone has any experience with realm?

Instead of user.sqllite, data is now stored to core.realm. I can open it with realm studio, now not sure how to convert/sort it for easier analysis. "Went to sleep" seems to be in minutes after midnight.

example of data fields in it:
[General Accessories] zlikovac:
so in realm db browser on win i can't convert it to csv, but on OSX version of realm browser i can :)
[General Accessories] patiw:
Is there any way to extract this data on iOS 11 and non-jailbroken iPhone? I tried method described in the first post but it's not working for me. Any help would be awesome!
[General Accessories] zlikovac:
[MENTION=5835376]patiw[/MENTION], i am not sure. I am on jb iOS 9.0.2.

You can tho on non jailbroken phone, sync mi fit data to health.app, then export data from health as xml and convert it to csv (google Apple Health XML to CSV Converter).
[General Accessories] pirasalbe:
EDIT: found the post that make it works
[General Accessories] josejuancortes:
I have a problem, run.sh doesn't find origin_db and origin_db-journal.

Anybody has the same problem?

why?
[General Accessories] Mr. Duke:
Hi all! What a useful thread here! Tell me please, is it possible to extract the data, modify it and import back again? Today I was very busy and forgot to make enough steps to reach the goal (what I've been doing for 200 days already). So I want to fix it somehow and continue reaching the goals. Help me plz.
[General Accessories] Bonoboo:
Yes. Follow this (seems Google Translate not needed for you)

In current Mi Fit db file now named with numbers-letters prefix.
[General Accessories] Mr. Duke:
Oh, thanks a lot mate! :good: I've fixed it!!! The show must go on :cool:
[General Accessories] rubenix:
For some unknown reason the generated html file does not show up the 2018 calendar in 'mi_data_byDoW.html' --> the 'extract.js' has all info up to date and it shows the info for days in 2018 in 'mi_data.html'

It happens top anybody else?

i've been checking the code in the html files but don't know how to fix it...any ideas?
[General Accessories] Brexit:
I have it for three years already and never had any problems
[General Accessories] rubenix:
@Brexit, Can I pass you my extract.js file and verify what the html pages does for you?

Thanks!
[General Accessories] Mr. Duke:
I've lost it again...

I thought MiFit keeps all the data locally on the phone and in the band. But recently I've chaged the phone and the data was synchronized... but not from the band! Probably, it was taken from XiaoMi servers, unchanged, like I've never edited it before!
[General Accessories] mibanddd:
That's true, Mi Band "phones home". That is why you need an online account for it and that is why it is able to compare your sleep/health data to others.
[General Accessories] Mr. Duke:
You're right. But just a couple of months ago I could easily adjust the data on my phone, then synchronize it with the band (being online) and that's it. I had nothing to do with their servers' data. I think they've just fixed that "bug".

When I restore my old backup and synchronize it offline, I've got old adjusted data + new data from the band combined. But when I go online the old adjusted data is replaced with the original one from their server. So, from one hand you can't cheat anymore and from another you won't accidentally lose your data and you don't have to restore it manually.
[General Accessories] DirtyBitz:
Is it possible to extract the mi band data now with an unrooted android phone? I have my mi band 2 exactly one year and really would like to view the info in Excel.

Hope it will work!

Tom
[General Accessories] mibanddd:
Here I described the possibilites for non-root phones:

https://xdaforums.com/showpost.php?p=69640664&postcount=275

Try the modified additional app:

https://xdaforums.com/showpost.php?p=69133139&postcount=266

Is it able to download your Mi Band 2 data from the chinese servers?

Then you should be able to download the backup to your computer including app data from package "com.xiaomi.hm.health.backup", following the known adb backup command instructions.

If this app doesn't work anymore then someone should follow the steps in the mentioned post to create a new app like this. Or you should try to find older versions of the normal app that allow backup. Because it is technically possible to temporarily replace an app with an older version and then again install the current one.
[General Accessories] DirtyBitz:
I have backuped com.xiaomi.hm.health.backup from the modified additional app with Helium backup. How can I acces the data now? Should i try to unpack the ab file? Thanks already!
[General Accessories] mibanddd:
In an older version of miband_extract, there was some code included to try to backup and unpack the backup. It looked somehow like this:

:bin\tail -c +25 mi.ab > mi.zlb
... etc

Like this it should work to get the origin_db_.... file. Maybe you need to edit the batch file somehow to work with your origin db file.
[General Accessories] DirtyBitz:
Thanks, but I have no idea how to do this... Is there no other way?

I've tried several times to run miband_extract but it never works
[General Accessories] mibanddd:
Try this version:

https://www.xup.in/dl,15163439/miband2_extract_2018-05-02.zip/

Execute for_unrooted_android.bat

If it does not work, have a look at the generated mi.tar file before it will be deleted. Does it contain the desired origin db at all?
[General Accessories] mibanddd:
Okay, I guess the backuped files are going to a different folder now. I have corrected this.

Try this:

https://www.xup.in/dl,15163439/miband2_extract_2018-05-02.zip/
[General Accessories] DirtyBitz:
I moved my origin.db files to the folder temp and replaced the files there. Then I run the batchfile extract_date and the html file opened with my data. I works now!

Thank you very much!
[General Accessories] mibanddd:
Great, you're welcome!
[General Accessories] rubenix:
i have not found any answer on this yet..any help? its just the 2018 calendar not showing up at all....mi_data.html file shows all the info up to date.

thanks in advance!
[General Accessories] 2081105:
does not work at new version of 3.3.6

Could you please help me?

I am afraid for unrooted android.bat you recently uploaded is not working under the new version of mifit app released May 28.

Non-rooted phone? Attemting backup approach

Non-rooted phone? Attemting backup approach

Non-rooted phone? Attemting backup approach

unpacking backup file

miniz.c version: 9.1.15

Mode: d, Level: 9

Input File: "mi.zlb"

Output File: "mi.tar"

Input file size: 0

inflate() failed with status -5!

bin\tar: apps/com.xiaomi.hm.health.backup/databases/origin_db*: Not found in archive

bin\tar: Error exit delayed from previous errors

The system cannot find the path specified.

deleting temp files

Non-rooted phone? Attemting backup approach

unpacking backup file

miniz.c version: 9.1.15

Mode: d, Level: 9

Input File: "mi.zlb"

Output File: "mi.tar"

Input file size: 0

inflate() failed with status -5!

bin\tar: apps/com.xiaomi.hm.health.backup/databases/origin_db*: Not found in archive

bin\tar: Error exit delayed from previous errors

The system cannot find the path specified.

deleting temp files
[General Accessories] bingen:
Probably off topic, but I recently discover, via mi fit help, that you can export all the data to .csv files simply via mifit.huami.com/t/account_mifit you only need to login with your mi account (google & more are supported too) and select the dates. (on the same page you can also delete all the data, but be careful, since this action is not recoverable )
[General Accessories] Steelskinz:
Didn't know that site. Thanks.
[General Accessories] imdavidmin:
Can you add extract weight data as a future feature?
[General Accessories] Bonoboo:
Thanks for sharing!

Also here nice online service for creating graphs from CSV.
[General Accessories] tsvx:
Unfortunately, it does not work for me for some reason, it responds with "default backend - 404" text.

Maybe there is some blocking rule (for Russia where I'm accessing from).

Nevertheless, accessing the page via Opera VPN works fine, thank you for sharing!
[General Accessories] kurci2:
Have anyone tried to get this to work with MiBand 3?

I get this when I run miband_extract_v592:

Extract Started

sob. 15. 12. 2018

Renaming

ADB SU copy to sdcard

ADB pull

Cannot find database files. Non-rooted phone? Attemting backup approach

unpacking backup file

miniz.c version: 9.1.15

Mode: d, Level: 9

Input File: "mi.zlb"

Output File: "mi.tar"

Input file size: 0

inflate() failed with status -5!

bin\tar: apps/com.xiaomi.hm.health/db/origin_db*: Not found in archive

bin\tar: Error exit delayed from previous errors

bin\tar: apps/com.xiaomi.hm.health/db/mihealth*: Not found in archive

bin\tar: Error exit delayed from previous errors

deleting temp files

The system cannot find the path specified.

The system cannot find the path specified.

The system cannot find the path specified.

Still cannot find files. Restoring original files

Thank you!
[General Accessories] kukualla:
MiBand 3

I used Ubuntu, I got my data from MiBand 3 to my computer by copying the origin_db_... file manually from the Android system through ADB (phone was rooted) and then modified the scripts a little bit to work with MiBand 3 (the 'id' field had to be removed from miband.sql, doesn't exist anymore). I got it working perfectly.
[General Accessories] kurci2:
Thank you for your reply!

Would it be possible for you to explain your procedure more thoroughly?

I stopped using MiBand because of poor Google Fit sync and an buying Fossil Sport Wear OS watch. I yould just like to transfer Heart rate data and steps to Google Fit and would be really greateful if you could help me. (I also have a rooted phone - Nexus 5X)

I have found database file in: /data/data/com.xiaomi.hm.health/databases - file is namedorigin_db_ad5a... (string of numbers and letters) and is 2.12MB large - data od last 14 weeks. Is that it?

Could you maybe share your code for Mi Band 3. In my case I just need one time sync of my data, but there might be other users with same problems...
[General Accessories] pedromarga:
Hi,

Is it possible to extract Xiaomi Mi Scale data from Mi Fit app using this tool?
[General Accessories] IlluminatusII:
Is there any posibility to get sleep data (REM) in realtime from miband 4? Raw data don't interesting. For my project with arduino and etc. Or maybe sensor + sleep phase recognition.
[General Accessories] kalgan:
hi! can somebody help me out?

mi band extract wont work for me, I think it should be the path of sdcard... the default /sdcard doesnt work, /storage/sdcard0 neither...

I have a stock galaxy s8, what should be the SDpath value? How can I investigate it?

thx for your help!
[General Accessories] Bonoboo:
It's too outdated and abandoned. I doubt someone beside author can fix it.

Try export data from cloud in CSV and plot manually
[General Accessories] kalgan:
thx for the advice, but it doesn't work too... it says it will send my data in cca 30 minutes in mail, but I never get any mail...
[General Accessories] Bonoboo:
Tried myself, got e-mail after ~5 minutes. Maybe check spam folder or try again with address from other provider (not GMail).
[General Accessories] kratos69:
Awesome tool, :good::good::good::good:
[General Accessories] herpez:
Hi!

I extracted files with Bonoboo tasker extraction tool, and got a Mi_Band_Table.csv

I tried to use fitnesssyncer to synd and i got the error "Unknown error has occurred. (Sun Feb 08 16:06:14 PST 2015)"

Any ideas? Maybe the csv from tasker is different? I wanted to use your extraction tool to try, however, my OSX isnt capable to adb right now (always show device offilne...)
[General Accessories] xmxm:
Did you use latest version of Bonoboo tool?

How many columns do yo have in CSV file? There should be 23 columns for import to work properly.

If you already have 23 columns, could you please send me the CSV file or at least few lines from it for troubleshooting?
[General Accessories] herpez:
I will send you the csv by pm

I has only 17 columns... :s
[General Accessories] Vanyatka:
Worked successfully, nice job xmxm!

Xiaomi 1S Global official ROM (Android 4.3 - MIUI JHCMIBH-45.0) with Mi Band official version from Play Store (1.1.961).

To make adb work I had to install Xiaomi1S driver for windows by someone here from xda.
[General Accessories] herpez:
Thanks xmxm for your help.

Tried with the extraction tool apk and it's working... I will update the tasker to make it work...

Hope fitnesssyncer syncs with google fit someday... cause it would be wonderful to have all my tracks in one place (food on fatsecret, gym at google fit and runkeeper, and steps and sleep on miband...)
[General Accessories] Chadneu:
Great tool!
[General Accessories] wmarcin:
Fantastic! Many thanks for this!

... moto x vzw ...
[General Accessories] RobLudo:
Amazing! Thanks for your work, this tool is simply great.
[General Accessories] herpez:
Hi.

I'm using Tasker to extract because I cant connect my laptop to my mobile.

Can you tell me the differences in the extraction so i can update my tasker?
[General Accessories] macia10:
Seems that fit2 works great but one thing though ;] What to do when I have fit installed on my phone and it gatheres steps and I add data from mi band. They sum up and I have twice as much steps ;p Will I have to uninstall google fit from my phone?
[General Accessories] herpez:
Is it possible to have the fit tool on osx?

Thanks
[General Accessories] xmxm:
I hope Bonoboo updates his program, but in the meantime you can just take db\miband.sql file from v5.71 and replace the version of same file that comes with Tasker package.
[General Accessories] xmxm:
If you have Google Fit on your phone and it already counts your steps, why would you want to Sync the data from Mi Band?

As far as I understand the way Google Fit works, my app could only delete data that was created by app itself, so you'll need to pick just one app to feed the data into Fit.
[General Accessories] herpez:
I guess it's because google fit app is less accurate than miband, and because we wear miband all day and not the mobile phone.

I think i understand his question, because i also have google fit app installed, so i can add sport activities, however i would like the steps to come from miband. Unfortunatly, google fit app doesnt let disable step count.
[General Accessories] xmxm:
It might be technically possible but I do not know Unix/OSX shell scripting well enough to translate "for /F" behaviour and calling subroutines. You may be able to get native curl and jq apps for OSX and then try to manually reproduce all steps from the batch, but this might be a complex undertaking. I think that at this point it might be easier to install VM with Windows or use some Wine implementation to run it natively under Windows.
[General Accessories] xmxm:
So my understanding is that you'd like to have steps coming from Mi Band, but to be able to enter other activities from Google Fit, right? I haven't used Fit app on my phone much, but I do not think it is counting steps for me. When I open settings in Google Fit on my smartphone, I see "Activity detection" switch which reads "allow Google Fit to collect & store data, including your location". I have this setting OFF. Could you try changing it to OFF and see if it stops step counting?
[General Accessories] herpez:
I don't know it it was the other user doubt... However for me it solved.

Thanks
[General Accessories] cliq:
can there be a way to make this band vibrate when user is idle lets say for 30mins or an hour? If not, can this funtion be implemented into the MiBand app?
[General Accessories] xmxm:
I'd recommend to look into tools made by Bonoboo: http://xdaforums.com/showpost.php?p=56311839

I think that this might match what you are looking for: http://xdaforums.com/showpost.php?p=58714678
[General Accessories] macia10:
Yes that would be great as for example mi band does not count biking and fit does that perfectly and for steps band is better as I dont have phone on me all the time ;)
[General Accessories] xmxm:
Do you need "Activity Counter" to be enabled for biking and other activities? If not, keep it OFF and it should not count your steps.

If you need to keep that setting ON, I wonder if you could classify steps coming through Google Fit as some other activity (other than walking)?

I can look into whether it is possible to delete a specific data source in Google Fit, but I do not know if my app would have permissions to delete data published by other app. If you want to proceed this way, please run following command:

fit listds

and send output to me.
[General Accessories] cliq:
Thanks for your prompt reply. Unfortunately I can not use this because I dont have root access on my phone :(
[General Accessories] Sean09:
Hi, and thanks for the great work. I got my steps to work fine, however my sleep data shows nothing in the stream. When i go to edit sources the fields are missing except the first one. I can only see the others if i delete then add them again. My data for sleep refuses to work. Any ideas why it disappears when i edit it, and why no data is showing?

Edit, works after editing, changing the drop down then moving it back and saving!
[General Accessories] xmxm:
As of now I am not aware of pulling data through tasker without root. Desktop application would work without root, but Tasker profile would not.
[General Accessories] xmxm:
Are you referring to Google Fit sync functionality? Where are you editing sources?

I am not sure what exactly you are trying to do, but so far I was not able to make Sleep data to show in Google Fit. If you made sleep data show up in Google Fit, please let us know how you did it.
[General Accessories] Sean09:
Sorry to be unclear, i was following your steps to get it on fitnesssyncer and it wasn't working properly.
[General Accessories] LA_:
OSX 10.10.2

Dear all,

need you help to get it working on my OSX 10.10.2 and unrooted phone.

First of all, I've modified run.sh to defined right path to adb - changed all occurences of adb to /path/to/adb.

Now, when I run the script, it starts backup process (I see the backup confirmation on the phone screen), but then the script terminates. Looks like it doesn't wait for backup completion (it least I see according notification on the phone after script closure).

Please see the log below.

ok

Cannot find database files. Non-rooted phone? Attemting backup approach

Press Backup My Data button on device...

Now unlock your device and confirm the backup operation.

unpacking backup file

tar: Unrecognized archive format

tar: apps/com.xiaomi.hm.health/db/origin_db-journal: Not found in archive

tar: apps/com.xiaomi.hm.health/db/origin_db: Not found in archive

tar: Error exit delayed from previous errors.

deleting temp file

cp: apps/com.xiaomi.hm.health/db/origin_db*: No such file or directory

Extraction failed

Still cannot find files. Restoring original files

But somehow I managed to see and copy mi.ab file.

I've tried to process it manually -

tail -c +25 mi.ab > mi.zlb
cat mi.zlb | openssl zlib -d > mi.tar
openssl:Error: 'zlib' is an invalid command.

I have OpenSSL 0.9.8zc 15 Oct 2014, SQLite version 3.8.5 2014-08-15 22:37:57, zlib 1.2.5. Do I use last command incorrectly?
[General Accessories] xmxm:
You need OpenSSL binary that supports zlib functionality. To see options that were used to compile your OpenSSL, you can run following command:

openssl version -f

If it supports zlib, it would list either -DZLIB or -DZLIB_SHARED - first option means that zlib library is statically linked to executable while second option would try to load zlib library dynamically. If neither option is shown, this would mean that this particiular binary does not support zlib. You might need to find another pre-compiled binary for OSX or compile it yourself from sources http://wiki.openssl.org/index.php/Compilation_and_Installation
[General Accessories] LA_:
Here is the result:

DZLIB is there.
[General Accessories] xmxm:
Hmm, that is strange. Based on quick search, I would recommend trying of following three options:

1. Try getting openssl version 1.0.0 or higher for OSX

2. If you have Python installed, you can try replacing

... | openssl zlib -d | ...

with

... | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | ..

3. It is said that qpdf package has an app called zlib-flate which could be used instead of openssl. It seems that qpdf could be installed on OSX: http://stackoverflow.com/questions/16956875/how-can-i-install-qpdf-on-mac-10-8-3

I haven't tried these options myself, so your mileage may vary.