As of July, 2024, there are breaking changes to the Huawei export format. Unfortunately, these changes also involve the raw data on which Hitrava relied to create your exported activities, to have disappeared. This will be apparent by Hitrava returning a message that decoding and decompressing of the ZIP file failed. I regret to inform you that Hitrava probably will not be able to export your activities in the future. The program is still available for now for users who want to convert any export files in the original export format.
Hitrava converts health activities registered using a Honor or Huawei activity tracker or smartwatch in the
Huawei Health
app into a file format that can be
directly uploaded to Strava
.
22-Apr-2024: Hitrava Web just got updated!
Though it is still an alpha release, it is the last step before a fully functional beta version.
The cthru website also got a major update and upgrade and is now always available.
If you prefer on-line conversion in a web app with GUI over a script,
you can give it a try on https://cthru.hopto.org.
To use Hitrava, you need:
Python 3.7.x
or higher.
Only required if you don't have a (suitable) python installation on your system.
Python website
.NOTE: This step is required to convert encrypted Huawei Health ZIP files.
7-Zip website
.
The stand-alone version can be identified by the description below:
7-Zip Extra: standalone console version, 7z DLL, Plugin for Far Manager
Hitrava.py
7za.exe
Run_Hitrava_Decrypt.cmd
All users can use conversion from a ZIP file or a JSON file.
For users with rooted phones, legacy file and
tar options are still available.
NOTE: As of late October 2020, the latest version of the Huawei Health app obliges you to provide a password with which your data in the ZIP file will be encrypted. If you need to convert from an older non-encrypted ZIP file, please refer to the corresponding example.
Activities can be mass converted using the data in a ZIP file that you can request in the Huawei Health app.
The procedure below assumes that you installed Hitrava and are logged in with your Huawei account in the Huawei Health app. If you don't have a Huawei account, you can create one in the app.
Before you read any further in this paragraph, there is a complete step-by-step guide with pictures on how to request your Huawei Health data. Head over to the 'How To Convert' article on the cthru website.
Tip: If you're on Windows, and you're not familiar with the Command Prompt or just want to do a quick conversion with default arguments, you can use the _Run_HitravaDecrypt.cmd batch file.
- Open the _Run_HitravaDecrypt.cmd file with a text editor and change the password 123456 to the password you provided in step 2 above.
- double-click the _Run_HitravaDecrypt.cmd file in the installation folder of Hitrava.
This will convert all available activities in the ZIP file from the previous step.
IMPORTANT: You must replace the password 123456 with the password you provided in step 2 above.
Hitrava.py --zip HiZip.zip --password 123456 --json_export
The above command will generate both the original HiTrack files and the converted TCX files for ALL activities to the output subfolder of the Hitrava installation folder. In this folder:
You can now go to the Strava website to import your data.
'Upload and Sync Your Activities'
page on Strava. Follow the same procedure as for Windows users explained above.
Motion path detail data & description/motion path detail data.json
python3 Hitrava.py --json HiJson.json --json_export
The above command will generate both the original HiTrack files and the converted TCX files for ALL activities to the output subfolder of the Hitrava installation folder. In this folder:
Follow the same procedure as for Windows users explained above.
usage: Hitrava.py [-h] [-z ZIP] [-p PASSWORD] [-j JSON] [--json_export] [-f FILE]
[-s {Walk,Run,Cycle,Swim_Pool,Swim_Open_Water}] [-t TAR]
[--from_date FROM_DATE] [--pool_length POOL_LENGTH]
[--tcx_insert_altitude_data] [--output_dir OUTPUT_DIR]
[--use_original_filename]
[--output_file_prefix OUTPUT_FILE_PREFIX]
[--suppress_output_file_sequence] [--validate_xml]
[--log_level {INFO,DEBUG}]
optional arguments:
-h, --help show this help message and exit
--log_level {INFO,DEBUG}
Set the logging level.
JSON options:
-z ZIP, --zip ZIP The filename of the Huawei Cloud ZIP file containing
the JSON file with the motion path detail data to
convert. The JSON file will be extracted to the
directory in the --output_dir argument and conversion
will be performed.
-p PASSWORD, --password PASSWORD
The password of the encrypted Huawei Cloud ZIP file.
Required for encrypted ZIP files only.
-j JSON, --json JSON The filename of a Huawei Cloud JSON file containing
the motion path detail data to convert or the filename
of the Huawei Cloud ZIP file containing the JSON file
with the motion path detail data (this will work
identical to --zip argument above).
--json_export Exports a file with the JSON data of each single
activity that is converted from the JSON file in the
--json argument. The file will be exported to the
directory in the --output_dir argument with a .json
file extension. The exported file can be reused in the
--json argument to e.g. run the conversion again for
the JSON activity or for debugging purposes.
FILE options:
-f FILE, --file FILE The filename of a single HiTrack file to convert.
-s {Walk,Run,Cycle,Swim_Pool,Swim_Open_Water}, --sport {Walk,Run,Cycle,Swim_Pool,Swim_Open_Water}
Force sport for the conversion. Sport will be auto-
detected when this option is not used.
TAR options:
-t TAR, --tar TAR The filename of an (unencrypted) tarball with HiTrack
files to convert.
DATE options:
--from_date FROM_DATE
Applicable to --json and --tar options only. Only
convert HiTrack information from the JSON file or from
HiTrack files in the tarball if the activity started
on FROM_DATE or later. Format YYYY-MM-DD
SWIM options:
--pool_length POOL_LENGTH
The pool length in meters to use for swimming
activities. If the option is not set, the estimated
pool length derived from the available speed data in
the HiTrack file will be used. Note that the available
speed data has a minimum resolution of 1 dm/s.
TCX options:
--tcx_insert_altitude_data
When an activity has altitude information, inserts the
last known altitude in every track point of the
generated TCX file.
--tcx_use_raw_distance_data
In JSON or ZIP mode, when using this option the
converted TCX files will use the raw distance data as
calculated from the raw HiTrack data. When not
specified (default), all distances in the TCX files
will be normalized to match the original Huawei
distance.
OUTPUT options:
--output_dir OUTPUT_DIR
The path to the directory to store the output files.
The default directory is ./output.
--use_original_filename
In single FILE or TAR mode, when using this option the
converted TCX files will have the same filename as the
original input file (except from the file extension).
--output_file_prefix OUTPUT_FILE_PREFIX
Adds the strftime representation of this argument as a
prefix to the generated TCX XML file(s). E.g. use
%Y-%m-%d- to add human readable year-month-day
information in the name of the generated TCX file.
--suppress_output_file_sequence
Suppresses the sequence number suffix in the filenames
of converted TCX files when converting activities in
ZIP or JSON mode.
--validate_xml Validate generated TCX XML file(s). NOTE: requires
xmlschema library and an internet connection to
retrieve the TCX XSD.
Use the command below to convert all activities available in the encrypted ZIP file with the Huawei
Privacy data (here with filename HiZip.zip) that were started on October, 3rd, 2019 or later.
The ZIP file was encrypted with password 123456 provided in the Huawei Health app.
The following files will be generated in folder _./my_outputdir:
python Hitrava.py --zip HiZip.zip --password 123456 --json_export --from_date 2019-10-03 --output_dir my_output_dir
Use the command below to convert all activities available in the ZIP file with the Huawei Privacy data (here with filename HiZip.zip) that were started on October, 3rd, 2019 or later. The following files will be generated in folder _./my_outputdir:
python Hitrava.py --zip HiZip.zip --json_export --from_date 2019-10-03 --output_dir my_output_dir
Use the command below to convert all activities available in the motion path JSON file from the requested Huawei Privacy data that were started on October, 3rd, 2019 or later. Source HiTrack files and converted TCX files will be generated in folder _./my_outputdir/json
python Hitrava.py --json "motion path detail data.json" --from_date 2019-10-03 --output_dir my_output_dir/json
Same as above, but also create an additional export file for each converted activity containing the raw JSON data of that activity from the motion path JSON file.
python Hitrava.py --json "motion path detail data.json" --json_export --from_date 2019-10-03 --output_dir my_output_dir/json
The example below converts extracted file HiTrack_12345678901212345678912 to HiTrack_12345678901212345678912.tcx in the ./output directory
python Hitrava.py --file HiTrack_12345678901212345678912
The next example converts extracted file HiTrack_12345678901212345678912 to HiTrack12345678901212345678912.tcx in the ./my_outputdir directory. The program logging level is set to display debug messages. The converted file is validated against the TCX XSD schema (requires xmlschema library and an internet connection).
python Hitrava.py --file HiTrack_12345678901212345678912 --output_dir my_output_dir --validate_xml --log_level DEBUG
The following example converts an extracted file HiTrack_12345678901212345678912 to HiTrack12345678901212345678912.tcx in the ./output_ directory and forces the sport to 'walking'.
python Hitrava.py --file HiTrack_12345678901212345678912 --sport Walk
The next example converts an indoor swimming activity in an extracted file HiTrack_12345678901212345678912 to HiTrack_12345678901212345678912.tcx. The length of the pool in meters is specified to have a more accurate swimming data calculation.
python Hitrava.py --file HiTrack_12345678901212345678912 --pool_length 25
The first example extracts and converts any HiTrack file found in tar file com.huawei.health.tar into the ./output directory. The output directory will contain both the extracted HiTrack file and the converted TCX XML file.
python Hitrava.py --tar com.huawei.health.tar
In the example below, only activities in the com.huawei.health.tar tarball that were started on August 20th, 2019 or later will be extracted and converted to the ./output directory.
python Hitrava.py --tar com.huawei.health.tar --from_date 2019-08-20
For a full changelog of all versions, please look in CHANGELOG.md
.
Copyright (c) 2019-2023 Christoph Vanthuyne
Licensed under the Non-Profit Open Software License version 3.0 from Hitrava version 3.1.1 onward.
Read the full license information here
.
If you're more into a TL;DR approach, start here
.