yashsingh1/xdaforums huggingface dataset:
[General Accessories] thegadetnook:
update the app from mi store

Running or route tracking option in the mi fit app is available only on the mi store version. Playstore version still does not have this. Install the original app from playstore and then install mi store apk. Then via mi store search mi fit app and it will suggest to update it. Once done (offcourse it will download the apk and isntall automatically) you can use the heart rate monitor while running. It vibrates when u go over the limit set for heart rate. I am putting up a review soon on youtube.
[General Accessories] ASLANOO:
Getting the same error. Xperia Z5 Mi App version 1.8.111

All analytics and extract packages are in downloadsfolder
[General Accessories] ASLANOO:
Now I know where the problem is.

The developer can easily correct this I think.

The software is working for Mi Fit App until version 1.6.XXX from 1.7.XXX it is giving an error that the file can not be found. I guess the app stores it somewhere else or differently from that version on.

Find Mi Fit app wit v 1.6.XXX from apk mirror
[General Accessories] neouj:
getting an error , " system cannot find the file specified" .

Please help
[General Accessories] batp:
had no luck with run.bat, it would not recognize sd card path. I just set folder-sync to sync the mi-stats extract folder with my one drive and that's a lot simpler.
[General Accessories] macia10:
Hm, just checked on new 1.8.111 and all works perfectly fine. I'm on CM12.1 and it extracted everything without any issues.
[General Accessories] herpez:
Here on 1.8.111 still not working (AOSP unrooted)
[General Accessories] hallihallo2:
There is a bug in the .sh script, so extraction does not work correct.

I found a git repository, where someone adapted the script to work for me:

https://github.com/Dolnor/mifit-data-export

I also like the raw export. Now, it would be nice, if we can export the heartrate too. But I don't understand the blob-extraction.

I found out, that the heart-rate is in the same table in "data_hr". This is 1440 Byte. And a day has got 1440 minutes.

If you have activated pulse tracker at night, then there is a "Heart-Rate Reading" every 2nd Byte.

Is there anybody out there, who can insert that to the extraction, please?
[General Accessories] lohtse:
How do you activate pulse tracker????
[General Accessories] hallihallo2:
[MENTION=1677398]lohtse[/MENTION] i have the german version. There it is in the settings and is named:

Pulsüberwachung

Pulsmessung während des Schlafes, um die Genauigkeit der Messung zu erhöhen

So it is only while i'm sleeping.

edit:

here is a new version of the miband_raw.sql to extract your nightly heartrate ;)

attention: I renamed it to miband_raw_hr.sql

edit2:

corrected link:o
[General Accessories] tautal:
Excuse me, can you upload this updated miband_raw_hr.sql with heart-rate data or tell me where to find it? Because you only attached your scv file...
[General Accessories] hallihallo2:
oh sorry,

I corrected the link above
[General Accessories] crazy9:
Impossible to perform an extract

Hello,

I'm trying to perform an extract and I'm unable to do it.

I get this error message :

Le fichier spécifié est introuvable.

Le fichier spécifié est introuvable.

Le fichier spécifié est introuvable.

Le fichier spécifié est introuvable.

* daemon not running. starting it now on port 5037 *

* daemon started successfully *

/system/bin/sh: su: not found

remote object '/sdcard/origin_db' does not exist

remote object '/sdcard/origin_db-journal' does not exist

remote object '/sdcard/mihealth.db' does not exist

remote object '/sdcard/mihealth.db-journal' does not exist

rm: /sdcard/origin_db: No such file or directory

Press "Backup My Data" button on device...

* daemon not running. starting it now on port 5037 *

* daemon started successfully *

Now unlock your device and confirm the backup operation.

After that, a backup is requested on my phone, I say "Yes" and nothing happened.

As the root is not enabled, I think it cannot do the "su -" to copy in the script.

I have checked directly on the phone the path requested (/data/data/com.xiaomi.hm.health/databases) and I don't see anything (is the folder hidden by the mi band app ?).

However, I see that normally I can perform an extract without any root rigths.

Can you help me ?

Thanks in advance for your help.
[General Accessories] ASLANOO:
Use Mi Fit 1.6.352

http://www.apkmirror.com/apk/xiaomi-technology/mi-fit/mi-fit-1-6-352-android-apk-download/

seems that location has changed in newer versions.
[General Accessories] crazy9:
-----------

Great ! It works now ! This tool is very usefull to keep a detail for each night or get graphs :)

What is the difference between this version and the last version ?

Do you have another tool to manager the mi band ? Or a tool to use in addition to the mi app to enhance the available features ?

Thanks in advance
[General Accessories] pepemac:
Update in run.sh or run.bat?

Hello.

Does anyone know what changes must we do in run.sh or run.bat to update this files for new version of Mi Fit?

Thanks.
[General Accessories] alrett:
Hello,

Since I'm using Mi Fit 1.6.352 the extraction of the mi band data works fine.

I am also using a Mi Scale. The file "weight.csv" is generated during extraction process, but is empty.

Can someone help me? Thanks for your help!
[General Accessories] mez90:
i've downloaded the mi band notify v2 app from the play store ( https://play.google.com/store/apps/details?id=com.mc.miband1 ) the app has the ability to take your heart rate every few minutes and it can export it. while the mi fit doesnt do it automatically this is a nice alternative.

i havent quite figured out yet how to use fitnessSyncer to import the heart rate csv in to google fit yet,

if anyone works it out let me know :)
[General Accessories] pepemac:
Problems with ExportRawData

Hello

I'm working with version 1.6.352 and works fine.
[General Accessories] mcschweg:
I am even using a modded version of MiFit 1.8.511.

Daily sleep and activities are extracted and analysed just fine.

Over all, this ist a perfect way to reverse-engineer the data-collection and use them as we please.

The Xiaomi-Software is so bulky when it comes to analysis. i.e. WHY doesn't it save ALL the 10 minutes-sleep / -step data.

It would be no biggie. For me it is not only important to see, how many % of my sleep is deep, but WHEN the deep-sleep happened.

And not only for the night before, but for all nights in comparism.

Also that would show, how accurate ore reasonable the interpretation of the sleep-movements have been...

All those precious data - thrown away by the original app. Ridiculous.

Please continue your fantastic work on this sql-database. It would be very helpful! :)

Issues also for me:

- Just the health-file does not seem to be worked correctly, since the weight.csv remains empty thus my scale has produced lots of weight data. Is there someone that got it running correctly?

- Does anyone know, how to extract the 10 minutes-values of sleep-phases and steps-counted / activity for the actual day (and maybe for some past days)?
[General Accessories] quiyaca:
Xboxes
[General Accessories] pepemac:
Hello.

I have two questions:

Would be possible (through reverse engineering) insert a button in apk which allow us export (by email, for example) day and intraday (minute-by-minute) data?

Does anyone know if exist a desktop software which allow manage multiple users? I think that would be great for physical education teachers.

Thanks
[General Accessories] Impo5sible:
This version is not working for me - few files are missing and "mi_data.js" contain errors. I had to download the one from github https://github.com/ckesc/miband_analytics which works flawlesly.

Yea, I'm dumb and I've downloaded the source version which doesn't have few things.

So this version is working, as well, jut be sure you've downloaded the right version!

Thanks, OP for this amazing thing.

ad.

I'm using newest Mi Fit update (1.8.711), Mi Band S1 (with HR) on Android 6.0.1. (rooted). No need to download older version
[General Accessories] umcrying:
What's wrong?

I hope someone here can tell me about this.

The lastest Mi Fit works find with the band.

The have 2 version the first one call the original xiaomi version right !?

and the sec one we can find it on Play Store .

I have no idea why both is not the same ???

If I say , I need both google sync and running tracker. So, I can't do that?

WTH is wrong with that people???? :confused:
[General Accessories] Impo5sible:
I think there are two version because of google restriction.

The one from XIAMO site has more features - Running mode, Weight mode, more settings, but it doesn't support Google Fit yet. With playstore version you are able to sync to Google Fit.

You can use "not google play store version" and use this tool to sync data with Google Fit, but keep in mind, that you steps are counted as one - it wont filter steps by time - it doesn't do that for me, at least.

So, if you want proper sync with Google Fit you have to either wait or "downgrade" to Google Play store version.
[General Accessories] Tromalfr:
Hello,

I'm trying to find a solution with the empty weight.csv file.

I'm far than being a decent android or sql developper but it seems that the sql request in the miscale.sql is the source of the problem.

Replacing the current request

select distinct
UserName,
Date,
round(Weight,2)
,case when UserID = -1 then coalesce(b.CurrentVal,0.0) else TargetWeight end as TargetWeight
,case when UserID = -1 then coalesce(b.Height,0.0) else a.Height end as Height
,case when UserID = -1 and b.Height is not null and b.Height > 0 then round(Weight*100.0*100.0/(b.Height*b.Height),2)
when UserID > -1 and a.Height is not null and a.Height > 0 then round(Weight*100.0*100.0/(a.Height*a.Height),2) else 0 end as BMI
from
(
select strftime('%Y-%m-%d %H:%M',datetime(substr(timestamp,1,10),'unixepoch','localtime')) as Date,w.Weight
,case when w.UserID = -1 then 'Main_User' else u.Name end as UserName
,u.TargetWeight
,w.UserID
,u.Height
from WeightInfos w
left outer join UserInfos u on w.UserID = u.UserID
where w.UserID <> 0
) a,
(select CurrentVal,Height from WeightGoals where FUID = -1 order by DateTime desc limit 1) b
order by UserName,Date;

by this one

select
case when w.UserID = -1 then 'Main_User' else u.Name end as UserName
,strftime('%Y-%m-%d %H:%M',datetime(substr(timestamp,1,10),'unixepoch','localtime')) as Date
,round(w.Weight,2)
from WeightInfos w
left outer join UserInfos u on w.UserID = u.UserID
where w.UserID <> 0;

allows me to obtain a valid weight.csv file.

I doubt of being able to debug the current sql request by myself, so if one of you has the skills and time, it will be greatly appreciated ^^

Thanks in advance (sorry for my rusted english).
[General Accessories] Impo5sible:
Question:

Data get pulled from mifit app locally, right? So If I missed 10 days period (because bracelet have built-in memory it can work some time, approx 10 days; according to Xiamo FAQ) to extract data via this tool, I'm "screwed"?

thanks
[General Accessories] JizzInMyPants:
Anyone here know how to extract daily sleep data from phone as in what time the "deep sleep" and "light sleep" occurred?

Since that's the reason i bought 4 of these damn :P And now have to take screenshot everyday for the purpose

Noticed someone in here posted that daily sleep stats were in another file

reddit . com/r/miband/comments/2xnryk/how_do_you_view_detailed_sleep_records_from/ (p.s. cant post links ;-; )

Want to basically know which file is that? Since i thoroughly looked through each file in data/data/com.xiaomi.health and couldnt find it
[General Accessories] gauge007:
Hi all,

thank you for the great work.

Just a question, is it possible to know the data location for the new version?

Thank you
[General Accessories] docontheroc:
exporting from iphone on pc

i have gotten itools to work and exported the user.sqlite file to the db subdirectory but when i run runIOS the extract csv file and the analytics html files are all empty. is this because my phone is not jail broken? what am i doing wrong...
[General Accessories] svintuss:
Looks like as of v. 2.0 MiFit App uses Realm DB instead of SQLite. So you can't use this toolset to extract data anymore.
[General Accessories] Pridexs:
For Non Root phones with MiFit version 1.8+ (Haven't tested with 2.0+ since someone said they now use RealmDB) you need to edit the .apk and set the android:allowBackup to true in the Manifest file. I used version 1.8.711 from apkmirror and it's working now. :)

Beware though, Xiaomi does not know how to store your data properly. I lost everything except for the last 7 days when I uninstalled the app. (Not sure if this is intended actually)
[General Accessories] kulichcz:
daily sleep report

Hello,

is there a way to export daily sleep report graph - the one that shows exact parts of deep/light sleep?

I am sorry if this question was posted already, but i missed it...
[General Accessories] Bonoboo:
Hi.

No.

Also I just take screenshot every morning and therefore have graphs for all nights.
[General Accessories] hanxue:
Script for MiFit 2.0

I am using MiFit 2.0 with MiBand Pulse, and the original script is not working. I have modified it to work with MiFit 2.0

github.com hanxue/mifit-data-export/tree/mifit-2.0

Feedback and suggestions are welcome. Please create a Github Issue if you encounter any problems.

Note: I still have not exceeded 10 post, cannot link directly. This is the patch

diff --git a/db/miband.sql b/db/miband.sql
index 98dc1d6..0c9c5f6 100755
--- a/db/miband.sql
+++ b/db/miband.sql
@@ -72,7 +72,7 @@ cast(RunDistanceMeter as text)||","||cast(RunTimeMin as text)||","||cast(RunBurn

||"]"||case when date = (select max(date) from date_data) then "" else "," end
from (
-select id,date,
+select date,
summary,
cast(rtrim(substr(summary,instr(summary,'"lt":')+5,7),', "st":') as Integer) as LightSleepMin,
cast(rtrim(substr(summary,instr(summary,'"dp":')+5,7),', "ed":') as Integer) as DeepSleepMin,
@@ -101,7 +101,7 @@ cast(rtrim(substr(summary,instr(summary,'"cal":')+6,4),', "runD') as Integer) as
.output minmaxtime.csv

with MyTable as (
-select id,datetime(date,'utc') as dt,
+select datetime(date,'utc') as dt,
datetime(cast(rtrim(substr(summary,instr(summary,'"st":')+5,10),', "wk":') as Integer),'unixepoch','utc') as SleepStart,
datetime(cast(rtrim(substr(summary,instr(summary,'"ed":')+5,10),', "v":') as Integer),'unixepoch','utc') as SleepEnd,
cast(rtrim(substr(summary,instr(summary,'"rn":')+5,7),', "cal"') as Integer) as RunTimeMin,
diff --git a/run.sh b/run.sh
index 80f4f9d..7e91789 100755
--- a/run.sh
+++ b/run.sh
@@ -49,7 +49,8 @@ function fetch_db_root
fi

echo $"adb copy $device temp data to sdcard" 2>&1 | tee -a log
-	./bin/adb shell "su -c 'cp /data/data/com.xiaomi.hm.health/databases/${data}* $SDPath/.'" 2>&1 | tee -a log
+	./bin/adb shell 'db=`su -c "ls /data/data/com.xiaomi.hm.health/databases/origin_db*(_+([0-9])) | tail -n 1"`; su -c "cp $db /sdcard/origin_db"' 2>&1 | tee -a log
+	./bin/adb shell 'db=`su -c "ls /data/data/com.xiaomi.hm.health/databases/origin_db*(_+([0-9]))-journal | tail -n 1"`; su -c "cp $db /sdcard/origin_db-journal"' 2>&1 | tee -a log
echo $"adb pull $device data from sdcard to local machine" >> log
./bin/adb pull $SDPath/${data} ./db/${data} 2>&1 | tee -a log
./bin/adb pull $SDPath/${data}-journal ./db/${data}-journal 2>&1 | tee -a log
[General Accessories] whochismo:
Incorrect data shown on graphs

Since a few days ago, I realised a few errors that didn't appear before.

First of all, in the Mi_Band_Table.html file, if I aggregate the data by week or month, most of the data appear as NaN:NaN in each row. The daily table seems to work just fine.

The problem is even worse in the Mi_Band_Graphs.html file. In the calendar chart, all squared appear in red for all data related to the walked steps (sleep data is displayed correctly).

[IMG="Mi band table error"]http://i.imgur.com/rzHwytr.png[/IMG]

[IMG="Mi band graphs error"]http://i.imgur.com/4dc9Wjr.png[/IMG]

What could be causing this problem? Am I the only one?
[General Accessories] signaleleven:
Thank you Hanxue!

I hope to be able to run it directly from tasker, as I am doing now with 1.8.

I held off until now in upgrading to 2.0 because of the reports of the adoption of RealmDB. As of today, AFAIK there are no python libraries or CLI tools to query RealmDB, only libraries for mobile development.

This is still using sqlite! Do they maintain a sqlite export of the realmdb? I still haven't tried upgrading to 2.0 at all (I have a spare miband, and a spare phone, I should set them up as a dev environment...)

Edit: saw the comment in your commit. Multiple sqlite databases. Interesting
[General Accessories] ntg110:
I think the current way if you installed 2.0 version, you should re-install older version (1.8+ with allowBackup = true in manifest) and get the result. This is the video i did to make new apk and use this thread to get data record.

youtube.com/watch?v=-0j6DLi3IPA

- Our record is stored on server, and after we re-install and login again, we can get database (in my case, I can get all except today record)
[General Accessories] psychopulp72:
Hi, I never get the message in the left corner for the backup. I'm Using MiFit 2.0.

Im getting this error on log file

Extract Started

02/06/2016

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

El sistema no puede encontrar la ruta especificada.

El sistema no puede encontrar la ruta especificada.

El sistema no puede encontrar la ruta especificada.

Still cannot find files. Restoring original files
[General Accessories] hutchinsfairy:
MiFit 2.0

I have been able to get this to work with my MiFit 2.0 app on Android.

1) My app has a /data/data/com.xiaomi.hm.health/databases/origin_db Sqlite3 file that hasn't been updated since I installed the app. Instead it is updating an Sqlite3 (not RealmDB) file called origin_db_1614346853.

2) I had to edit my miband.sql file to match this one.
[General Accessories] muscleriot:
Hi - Have mi fit pulse band and using Mi Fit 2.0 on a Samsung Note 2 with Windows 7.

For the benefit of others who don't quite know from the README how to set the PC up for this from scratch...

---------------------------------------

I installed AndroidStudio (free - maybe overkill) for the adb toolset, java utils etc..

I installed Samsung Kies (free - from samsung but needed a few reboots to fix drivers) to obtain the USB drivers for my SAMSUNG Galaxy Note 2 phone (without which nothing could happen).

I did a 'git clone' of the above directory on my desktop.

------------------------------------

I ran the bat file and got the backup message on my phone. So everything going great...

It then produced empty data files.

Now, I could downgrade to Mi Fit 1.8 but don't fancy losing data. Is there anyway of getting this data extraction to work with Mi Fit 2.0???
[General Accessories] franz101:
i got it working with mi fit 1.8.

it works really well with the data. I even could extract the heartrate

but i couldn't extract the weight data.

can it be that the mihealth.db is defected?
[General Accessories] hutchinsfairy:
See my post directly above yours.
[General Accessories] muscleriot:
Can't get new 2.0 code working under Ubuntu

After a lot of work have installed Android-studio on Ubuntu, setup udev rules to connect via USB to my device, altered my $PATH to point to ~/Android/Sdk/platform-tools so adb worked on the command line, and copied over the above code.

I made some minor changes to the run.sh file.

I replaced ./bin/adb to adb as I was getting permission errors...

I changed /storage/sdcard1 to /sdcard.

bash ./run.sh

extraction started on 06/22/2016 00:08
backing up MiBand database
adb copy MiBand temp data to sdcard
/system/bin/sh: su: not found
/system/bin/sh: su: not found
/system/bin/sh: su: not found
/system/bin/sh: su: not found
adb: error: remote object '/sdcard/origin_db' does not exist
adb: error: remote object '/sdcard/origin_db-journal' does not exist
cannot find database files. non-rooted phone? attempting native backup approach
Now unlock your device and confirm the backup operation...
17+0 records in
17+0 records out
17 bytes (17 B) copied, 0.000130034 s, 131 kB/s
tar: apps/com.xiaomi.hm.health/db/origin_db: Not found in archive
tar: apps/com.xiaomi.hm.health/db/origin_db-journal: Not found in archive
tar: Exiting with failure status due to previous errors
cp: cannot stat ‘apps/com.xiaomi.hm.health/db/origin_db*’: No such file or directory
extracted MiBand database
deleting temp backup files
extraction failed
still cannot find new database files - restoring original database backups
[General Accessories] robert1968:
Miband2 database copy

Hi,

I have Mi Band 2. :)

I copied my /data/data/com.xiaomi.hm.health/databases to here see attached.

Hope I helped developers :)

If any logs/data needed write me a mail!

(my xda logname + [MENTION=5499064]gmail.com[/MENTION])

Best Regards,

Robert
[General Accessories] vologa:
db of Mi Band 2 same

Hello! I check your data base with my IPython notebook github.com vologab/miband_jupyter_notebook/blob/master/Xiaomi_Mifit_miband_data.ipynb

Also, It's mean, It's compartible with modified scripts - see github.com vologab/miband_analytics
[General Accessories] robert1968:
Hi Vladimir,

Excellent! I didnt know it is exists. I try now! Thank you for it!

Xiaomi made a update yesterday for Mi Band 1s and MB2 firmwares and the Mi Fit apk.

I dont know whether database has been changed or not. but made a fresh copy attached.

I will try the extract tool today to check if its work with (new?) fresh data or not.

Best Regards,

Robert
[General Accessories] vologa:
Updated DB same.

Summary and raw data able to extract
[General Accessories] robert1968:
Hi,

Thanks.

I tried the Shell script but allways get error messages at this line:

sqlite3 ./db/`ls db | egrep '^origin_db_[0-9]+$'` < ./db/miband.sql | tee -a log

The miband_jupyter_notebook was real pain, :)

I installed Anaconda. but at import bitstring line raised error messages.

I tried on Ubuntu and a windows machine, but same error messages. No luck.

Is there any Live Linux image which contains Anaconda?

Best Regards,

Robert
[General Accessories] benjymous:
I tried this today, against the latest apk on a rooted phone, and it seems to be failing to find the data it expects:

Extract Started
22/07/2016
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

It appears that the mihealth* dbs don't exist:

127|root@crackling:/data/data/com.xiaomi.hm.health/databases # ls
mistat.db origin_db_1616315365 relation sports.db
mistat.db-journal origin_db_1616315365-journal relation-journal sports.db-journal
origin_db pri_wxop_tencent_analysis.db shoes.db wxop_tencent_analysis.db
origin_db-journal pri_wxop_tencent_analysis.db-journal shoes.db-journal wxop_tencent_analysis.db-journal

Do I need to do something within the app for them to get created, or are they no longer in use in the new version, and old users just have old leftover files?