dimarts, 20 de setembre de 2016

Export data from Xiaomi miband 2 (Mi Fit) to csv (Excel).

I achieved to export data from Mi Band 2 (Mi Fit).

Steps that worked for me.

1) Get root access to the phone. If you are root you can manage files from "/data/data/com.xiaomi.hm.health"

-You may have to change permissions in files and folders (you may need root explorer or other root file manager).

2) Follow the instructions from "http://forum.xda-developers.com/general/accessories/xiaomi-mi-band-data-extraction-t3019156"

Basically:
 -Follow preparation steps (Developer Mode..)
 -download miband_extract_v592.zip
 -It must be important to read all "http://forum.xda-developers.com/general/accessories/xiaomi-mi-band-data-extraction-t3019156" thread.


Running application:
1. Connect phone through USB and make sure USB debugging setting is enabled on your phone. Unlock phone screen.
2. Execute run.bat - if your phone is rooted, the data would be pulled automatically. If your phone is not rooted you would see backup screen and you need to press "Back up my data" button in the bottom left corner.
3. Data from your mi band will be saved to extract.csv file and extract.js. After extraction is complete, if OpenHTML is set to Y, mi_data.html will be opened automatically to show charts for your Mi usage.
4. HTML reports are using Google Charts framework and Google TOS does not allow storing their scripts offline along with the application, therefore you will need to have working internet access for reports to work. Your data is not being sent to Google, the internet connection is only used to download latest version of Google Charts javascripts.


3) Use a different sql for miband and miband2. Take into account that now Mi Fit db have a random number ex: origin_db_1623265978 it's not only origin_db.

I leave my run.sh here and my miband2.sql if it helps someone.

miband2.sql
run.sh

Rebuild miband_extract from xmxx..
miband2_extract_v6_just_a_mod_from_original_work_from_xmxx_xda_bonoboo

Thanks to xda-developers.com, bonoboo..

 Update 1/12/16:

 It doesn't work after last Mi Fit and mi band firmware updates, it must be changed db data. 


Update 22/04/17:

It works with this files
 miband2_raw.sql 
 miband2.sql