[General Accessories] xmxm:
Related links:

Latest version of Bonoboo port for smartphone extraction.

Known Issues:

1. Vertical axis is not always in sync for two charts in mi_data_byDoW.html

2. Timeline axis is only shown at the bottom of timeline

Version History:

[B]v5.92 06/20/2015[/B]
Added support for Mi Scale - extracting weight history into weight.csv

[B]v5.90 03/14/2015[/B]
Walking and Running statistics with minute granularity are now extracted from Raw data thanks to the input provided by mritsch and Osid.

[B]v5.80 03/07/2015[/B]
Google Fit sync package 0.3:
Fixed error in 1324438.json file which prevented Fit Sync for some users.
Added FitTools.bat which allows pulling various information from Google Fit account.

[B]v5.80 03/01/2015[/B]
Extraction package:
Added experimental support for raw data extraction. To enable raw data extraction, set ExtractRaw=Y in run.bat

Analytics package:
German localization added to analytics package (thanks to joshmosh)
default app_locale.js file is added to analytics package to support data extracted from iOS devices.

Data Extraction Tool v0.1 for iOS is added along with instructions on how to manually extract Mi Band data from iPhone

[B]v5.71 02/16/2015[/B]
Extraction package:
Extra fields added to extract.csv to support for Google Fit sync v0.2.
extract.json is not created anymore, this data is now calculated on the fly from extract.csv

Google Fit sync package 0.2:
Added sync for activity durations (walk duration, run duration, sleep duration)
Added sync for distance walked. Since distance metric is considered location, Token application will request new permission:
https://www.googleapis.com/auth/fitness.location.write
Fixed activity timestamps - Google Fit expects time to be in UTC time zone.

[B]v5.70 02/16/2015[/B]
Extraction package:
Initial support for Google Fit sync.

Google Fit package 0.1:
Initial release

[B]v5.50 02/05/2015[/B]
Extraction package:
Added new columns to CSV file for better FitnessSyncer compatibility.
Added support for time correction. See db\offset.sql for sample entries.
Updated run.sh from [URL="http://xdaforums.com/member.php?u=6091617"]jlaunay[/URL] to support new run.bat parameters and localization.

Analytics package:
Changed mi_data_byDoW.html to use AnnotationChart for right graph - support for time interval zooming.
Added new metric to mi_data_byDoW.html called "SleepTimeline" to show Sleep Timeline chart.
Various small fixes.

[B]v5.35 02/03/2015[/B]
Extraction package:
Fixed logging issue - adb would sometimes lock the log files and subsequent extraction invocations would fail completely on locked log files.
Added support for ADB over Wifi - see instructions in the first post.

Analytics package:
Fixed sorting order on main table
Second fix for incorrect sleep/wake hours calculation
Updated colors across all reports to be consistent
Converted total/deep/light sleep from minutes to hours and minutes in the main table. Show percentages of deep/light sleep compared to total sleep.
Add fall asleep and wake up times as selecrable metrics to mi_data_byDoW.html
mi_data_byDoW.html absorbed all functionality from mi_data_Sleep.html - the sleep calendar functionality and sleep timeline is available when you select Total Sleep metric. You will need to scroll down to see sleep timeline chart.

[B]v5.3 02/02/2015[/B]
Extraction package:
Add new column with number of walk time + run time in seconds (as per request)
Added new parameter ForceBackupMode to skip attempt at rooted extraction and go straight for backup mode

[B]v5.2 02/1/2015[/B]
Splitted program into data extract package and analytics packages. Data extract should be pretty stable now and reports could be updated independently.
Spanish translation (thanks to Viriatox)

[B]v5.1 01/31/2015 [/B]
Fix for incorrect sleep/wake hours calculation

[B]v5.0 01/31/2015[/B]
Localization setting is pulled from Mi database - no need to set it manually anymore (in most cases)
Two completely new reports - Sleep Report and Statistics by day of the week.
Fixes to unix shell script encoding.

[B]v4.0 01/29/2015[/B]
Month number calculation fixed.
Removed extra rows with zeroes that we incorrectly extracted
Localization moved to separate file, all other components are unified for all languages
Scripts for rooted and non-rooted phones combined into one.
Daily goals and data grouping added on main report.
Unix shell script for data extraction (thanks to jlaunay)
French translation (thanks to jlaunay)

[B]v3.0 01/26/2015[/B]
New script to support data extraction for non-rooted phones
Reverse sort order in table part of report, so newest dates are on top.
Week number and day of the week added to report.

[B]v2.0 01/25/2015 [/B]
All needed Windows binaries included in the package.
Batch file to automatically run all binaries to extract the data.
First report showing overall statistics.

[B]v1 01/24/2015[/B]
Initial release.

Syncronizing with fitnesssyncer.com

FitnessSyncer FAQ: https://www.fitnesssyncer.com/frequently-asked-questions

How to set up import and export.

1. Open account at fitnesssyncer.com/

2. On Dashboard, go to Sources and Destinations and select Add New Source

3. Select Type: Activity, source Amazon S3 (CSB), Dropbox (CSV) or OneDrive (CSV) depending on where your files are stored. Enter path and file name in Path field. Select highlighted columns mappings:

Activity:

Include Date (US) - Column 18

Include Activity - Column 19

Include Distance in Meters - Column 8

Include Duration in Seconds - Column 17

Include Calories Burned - Column 10

Include Total Steps - Column 9

[IMG="Activity"]http://i.imgur.com/46zy4jo.gif[/IMG]

4. Click on Save and authenticate into your cloud storage account.

5. Back on Sources and Destinations account, click on Sync Now link next to your newly added connection to confirm that it loads without errors. Click on Dashboard button and confirm that you see some data in charts there.

6. Go back to Sources and Destinations and select Add New Source again

7. This time, select Type: Sleep, same Source entry, same Path value and set up highlighted column mappings:

Sleep:

Include Date (US) - Column 18

Include Bed Time Hour - Column 20

Include Bed Time minute - Column 21

Include Awake Hour - Column 22

Include Awake Minute - Column 23

Include Sleeping Minutes - Column 2

[IMG="Sleep"]http://i.imgur.com/DiNbtiC.gif[/IMG]

8. Click Save, go to Sources and Destinations and click Sync Now on Sleep source now to see that it imports without issues.

9. Click on Stream option and see that you have both Daily Activity and Sleep data loaded.

10. Go back to Sources and Destinations and select Add New Destination Task

[IMG="Extract"]http://i.imgur.com/Fz6xrJf.gif[/IMG]

11. Select SyncType Activity and select Destination from the dropdown list

[IMG="Extract"]http://i.imgur.com/QssJ4Lq.gif[/IMG]

12. Repeat same steps for Sleep syncronization

Accessing your charts directly from Dropbox:

If you have a Public folder on your dropbox, you can copy all the .js and .html files there and get the shared url by selecting one of htmk files and selecting "Copy public link..." button. It would give you a URL that you can use from anywhere. You need to have Dropbox Pro account or free account created before October 4, 2012 for Public folder functionality to work on your dropbox.

[IMG="dropbox"]http://i.imgur.com/jnFSzaf.gif[/IMG]

Accessing your charts directly from Google Drive:

1. It is recommended that you create new folder in your Drive for this purpose.

2. Select the folder and Choose Share... option

3. On Share with others page dialog, click on Advanced button in bottom right corner.

4. On Sharing Settings dialog, click on Change... link at the top line of Who has access list.

5. On Link sharing dialog, select On - Public on the web option and click Save button.

6. Copy the URL that is shown on Sharing Settings page and click Done to close it

7. The URL that you copied will look something like the sample below. Copy just the alphanumeric sequence that is located between ?id= and &usp=sharing

https://drive.google.com/folderview?id=[B][COLOR="Red"]123-abcdcdefghijklmnopqrstUV[/COLOR][/B]&usp=sharing

8. Put www.googledrive.com/host/ before this string and /mi_data.html (or any other report) after it, you should get something like www.googledrive.com/host/123-abcdcdefghijklmnopqrstUV/mi_data.html - this should be your sharing link

Here is Google support page on sharing files/directories: https://support.google.com/drive/answer/2881970?hl=en

Using Helium backup instead of Android backup:

Helium produces .ab files that are ALMOST correct tar file, however besides extra characters on file header level they also have some differences in header entries for each file. I've looked through different methods and utilities and the best option so far is to use Helium_ab2tar.zip package (credit goes to xaos.cz for writing it and to johnny1176 for discovering it). It used to be available on xaos.ic.cz/Helium_ab2tar.zip, but that site is down now. You can still google for Helium_ab2tar.zip to find other locations that have copy of this file.

Plans for future versions:

0. Get more sleep :)
1. Titles for each chart
2. Implement dashboard comparing current week with previous statistical data. (For same days of week)
3. Use timeline component for right chart in data_byDow.htm
4. Show percentage of good days based on selected goals. Show min/max values for each metric.
5. Modify scatter chart to allow using any other series for X axis (Search/display correlations between sleep time and total number of steps).
6. Make a help page showing all the charts and how to use them.
7. Add ratio of deep/light sleep as part of selectable charts.
8. Merge all reports into single multi-tab document.
9. Parse detailed daily binary data - this is going to be a big one.

How to translate application to your language:

To add support for a new language:

For HTML pages

1. Open locale.js in editor supporting UTF-8 encoding.

2. Create a new section starting with

if (lang == "ru_RU") { }

and replace ru_RU with a locale string for your language.

3. Copy all strings from english version to inside { } brackets and translate the text.

4. Save file in UTF-8 encoding.

5. Add reference to your new language in comments section of config.js

For unix shell script:

For all subsequent entries, replace XX with 2-character locale name of your language

1. Create new po file using following command:

bash --dump-po-strings run.sh > po/XX.po

2. Edit newly generated file and translate msgstr entries using msgid entries as references

3. Save the file and generate new directory for the compiled langage file (.mo) using following command:

mkdir -p i18n/XX/LC_MESSAGES/

4. Compile .po file to .mo file by running following command:

msgfmt -o i18n/XX/LC_MESSAGES/mibandextract.mo po/XX.po

If you do not want to use the i18n folder and want the langage file to be system wide, you just have to comment (adding a #) the line "export TEXTDOMAINDIR=./i18n/" in the script.

Then you will have to move your po file to /usr/share/locale/XX/LC_MESSAGES/ (where XX is your langage).