Giter Site home page Giter Site logo

cthru / hitrava Goto Github PK

View Code? Open in Web Editor NEW
331.0 331.0 29.0 2.4 MB

Convert your Huawei Health sport activities and import them in Strava.

License: Other

Python 99.90% Batchfile 0.10%
band fitness gps gt health honor huawei import magic smartwatch sport sports strava tcx watch

hitrava's People

Contributors

aricooperdavis avatar cthru avatar tommyblue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hitrava's Issues

extract only heart rate data

hello, the question is simple. Is there a way to extract from the huawei data file of an honor magic wacht 2 watch, only the heart rate data. Thanks.
Describe the bug
A clear and concise description of what the bug is.

Logs
If applicable, add logging and error information from the application.
To enable full logging, add the command line argument --log_level DEBUG when running the program.

Files
If applicable, add relevant input and output files (by dragging them here).
For JSON conversions, you can use the --json_export command line argument. This will generate a separate .json file with the original Huawei HiTrack data for each activity that you can add here.

Note: be aware that your fitness activity files (may) contain personal data. We will notify that you can remove the attached files from your report as soon as we have downloaded them. We will ONLY use the files for debugging purposes.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Different data retrieved using HiTrava Web and Python version

Hello!

First of all, thank you and congratulations on this amazing tool.

Regarding the issue, I was comparing the activity uploaded from the TCX files and I noticed that when the same activity comes from either the HiTrava Web or the Python tool, it can have different info. Please check the pictures attached.

From Python

From Web

Any idea why this happens? Shouldn't it be exactly the same as the data source is the same?

Best regards,
Victor.

Updates to HiTrack file format.

Been trying to find a solution for Huawei Health -> Google Fit. Stumbled across Hitrava (awesome utility btw! ๐Ÿ‘)... and then I figured out how to get HiTrack files using BlueStacks+Root. ๐Ÿ˜‰

Unfortunately... going Huawei Health -> Strava -> Google Fit doesn't seem to be syncing my Heart Rate data across (which is what I'm ultimately wanting with my walks/elliptical/yoga sessions). ๐Ÿ˜ข

So, I've started playing around with things to see if I can develop something that will utilise the Google Fit REST API to load the .tcx files directly into Google Fit.

Anway, I have noticed some "extra"/undocumented fields in the HiTrack files depending on what device is used to initiate the activity:

If activity is started on phone (Nokia 7 Plus, Android 10, Huawei Health 10.1.1.312), I get "tp=alt" records...
tp=alt;k=1611458567000;v=33.70000076293945;

if started on watch (Huawei Watch GT2e), I get "tp=alti" records
tp=alti;k=1611601613000;v=5.7;

--

Also, when using phone to start activities... I get pm-n and pm-b records... I have deduced that these are:

tp=pm-n: Pace for last 100m
- k= Number of metres since start * 10000 (ie. k / 10000 => metres)
- v= number of seconds for last 100m

example:
tp=pm-n;k=42000937;v=64.0;

and

tp=pm-b: Pace for last 100yds
- k= Number of yards since start * 10000 (ie. k / 10000 => yards)
- v= number of seconds for last 100yds

example:
tp=pm-b;k=24000487;v=54.0;

Like p-m (Pace for last 1000 metres) and b-p-m (pace for last mile) records they don't have a timestamp to reference to beginning of activity or unix epoch etc. but I guess they might be useful for "split times"? ๐Ÿค”

--

Not sure if any of this is of any use, but thought it might be useful to have more of the HiTrack file format documented. ๐Ÿ‘

question about pool length

hello,
I have question about your program.

I try understand your code, for my improvements..
For swimming activity, you have command line argument (--pool_length).
If pool length is in json data (['wearSportData']['swim_pool_length']), you rewrite command line value?

And second question.
For next question about your code...
What is better?

  • question in issue
  • discussions
  • private message/email...?

[BUG] float division by zero (swimming activities)

Describe the bug
Whilst converting my backed up data, some events cause the program to crash. All 4/5 files that have the issue have a sportstype of 102

Logs
2020-05-01 22:58:57,327 - DEBUG - _get_pool_swim_data - Calculated swim data for lap 30 : {'lap': 30, 'swolf': 39, 'strokes': 12, 'duration': 27, 'distance': 25.0, 'speed': 0.9259259259259259, 'start': datetime.datetime(2019, 12, 4, 1, 14), 'stop': datetime.datetime(2019, 12, 4, 1, 14, 27)}
2020-05-01 22:58:57,327 - ERROR - generate_xml - Error generating TCX XML content for activity <HiTrack_20191204_120058>
float division by zero
Traceback (most recent call last):
File "./Hitrava.py", line 1322, in generate_xml
self._generate_swim_xml_data(el_activity)
File "./Hitrava.py", line 1437, in _generate_swim_xml_data
for n, lap in enumerate(self.hi_activity.get_swim_data()):
File "./Hitrava.py", line 705, in get_swim_data
return self._get_pool_swim_data()
File "./Hitrava.py", line 765, in _get_pool_swim_data
lap_data['speed'] = self.pool_length / lap_data['duration']
ZeroDivisionError: float division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./Hitrava.py", line 1800, in
main()
File "./Hitrava.py", line 1795, in main
tcx_activity.save()
File "./Hitrava.py", line 1500, in save
self.generate_xml()
File "./Hitrava.py", line 1367, in generate_xml
raise Exception('Error generating TCX XML content for activity <%s>\n%s', self.hi_activity.activity_id, e)
Exception: ('Error generating TCX XML content for activity <%s>\n%s', 'HiTrack_20191204_120058', ZeroDivisionError('float division by zero'))
2020-05-01 22:58:57,347 - DEBUG - _close_json - JSON file <./output/Motion path detail data & description/motion path detail data.json> closed

Files

[BUG] Incorrect output dates (several years between data points)

Describe the bug

My output TCX file contains dates in 2107 or later, and each GPS data point differs by several months or years (in reality logged each 5 seconds). Strava import understandably rejects these files. Problem is the same with web and local (Python) version. My computer has US English region setting, same problem with MacOS or Windows. I guess the date format is incorrectly parsed.

Some files parse correctly, some not, in any case, there are no errors thrown by the script (see attached log).

Logs
Files
Attaching input JSON and an example output TCX for a run that contains incorrect dates.

Additional context
What I did:

  1. Downloaded health data from Huawei in encrypted zip
  2. Clone GIT repo and added 7za.exe
  3. Ran python.exe .\Hitrava.py --zip ..\HUAWEI_HEALTH_20210426165642.zip --password *** --json_export

Input (all runs): [link removed]
Hitrava.py execution log: [link removed]
Output from script (example run from 22 sep 2020): [link removed]
Output from web converter for the same run: [link removed]

Huawei ENCRYPTED ZIP doesn't export anymore

Describe the bug
it doesnt export anymore. In output folder is just file Motion path detail data & description and it is empty

Logs
If applicable, add logging and error information from the application.
To enable full logging, add the command line argument --log_level DEBUG when running the program.
Screenshot (418)

Files
Screenshot (418)

Additional context
Add any other context about the problem here.

Error parsing json file

The py-file has been working fine until now, I got the error below:

2020-07-26 13:39:19,630 - ERROR - parse - Error parsing JSON file
'recordDay'
Traceback (most recent call last):
File "Huawei-TCX-converter.py", line 995, in parse
activity_date = dts.strptime(str(activity_dict['recordDay']), "%Y%m%d")
KeyError: 'recordDay'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "Huawei-TCX-converter.py", line 1560, in
main()
File "Huawei-TCX-converter.py", line 1545, in main
hi_activity_list = hi_json.parse(args.from_date,args.timezone)
File "Huawei-TCX-converter.py", line 1074, in parse
raise Exception('Error parsing JSON file <%s>', self.json_file.name)
Exception: ('Error parsing JSON file <%s>', 'motion path detail data.json')

Not sure what the error is with the RecordDay, could someone help me with this?

So far everything has been working fine, so I am not sure if this is a problem with Huawei's data or the code... Any help appreciated!

[SUPPORT] Converting Activities until a certain date

I used Hitrava and got the following exceptions, leading to the problem that my output only contains json and original huawei-health filey, but no tcx.
Exception Hitrava
The 2020-10-16 activity is a manually added swim-activity. That seems to be the problem, as I can convert the files FROM this date without any problem - but: In the readme I did not find a command to convert the activities UNTIL this date, in order to avoid the problematic activity. Is there a way to do this?

![no se puede exportar las actividades de octubre](https://user-images.githubusercontent.com/73828427/97885512-be62ad00-1d27-11eb-8591-c1609c408fc2.png)

no se puede exportar las actividades de octubre
C:\Hitrava-4.0.0>Hitrava.py --zip HiZip.zip -- galaxias2414--json_export
Info - External library xmlschema could not be imported.
It is required when using the --validate_xml argument.
It can be installed using: pip install xmlschema
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}]
Hitrava.py: error: unrecognized arguments: -- xxxxxxxxxxxx--json_export

Originally posted by @chemiso21 in #38 (comment)

[SUPPORT]Unable to generate the files

So i downloaded the source code and the repository.
I followed all the steps and then finally I ran the following command in the terminal
python Hitrava.py --zip HiZip.zip --json_export

I DID rename my huawei health downloaded zip to HiZip.zip.

I get the following error:
File "Hitrava.py", line 81
def init(self, activity_id: str, activity_type: str = TYPE_UNKNOWN):
^
SyntaxError: invalid syntax

I am on a MacBook air running Mac OS 10.15.6

KeyError: 'distance'

Hi,

was tracking a "free training" session today with my Huawei Watch GT2. So the tracked session only contains time and heart rate and no distance. Trying to convert gets me an error:

C:\Users\Robin\Desktop\Hitrava-3.5.3>python Hitrava.py --file C:\Users\Robin\Desktop\Hitrava-3.5.3\HiTrack_1598967061000159896887100030001
2020-09-01 16:33:54,825 - INFO - main - Hitrava version 3.5.3 (build 2008.1801) started with arguments ['--file', 'C:\Users\Robin\Desktop\Hitrava-3.5.3\HiTrack_1598967061000159896887100030001']
2020-09-01 16:33:54,825 - INFO - main - Running on Python version 3.8.5
2020-09-01 16:33:54,827 - INFO - parse - Parsing file <C:\Users\Robin\Desktop\Hitrava-3.5.3\HiTrack_1598967061000159896887100030001>
2020-09-01 16:33:54,830 - ERROR - generate_xml - Error generating TCX XML content for activity <HiTrack_1598967061000159896887100030001>
'distance'
Traceback (most recent call last):
File "Hitrava.py", line 1451, in generate_xml
self._generate_walk_run_cycle_xml_data(el_activity)
File "Hitrava.py", line 1513, in _generate_walk_run_cycle_xml_data
el_lap = self._generate_lap_header_xml_data(el_activity, segment)
File "Hitrava.py", line 1617, in _generate_lap_header_xml_data
el_distance_meters.text = str(segment['distance'])
KeyError: 'distance'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "Hitrava.py", line 1981, in
main()
File "Hitrava.py", line 1941, in main
tcx_activity.save(tcx_filename)
File "Hitrava.py", line 1642, in save
self.generate_xml()
File "Hitrava.py", line 1505, in generate_xml
raise Exception('Error generating TCX XML content for activity <%s>\n%s', self.hi_activity.activity_id, e)
Exception: ('Error generating TCX XML content for activity <%s>\n%s', 'HiTrack_1598967061000159896887100030001', KeyError('distance'))

worked fine so far with all my biking sessions with distance in it.
Thanks in advance

Not converting to TCX

Hello,
I think I followed the entire procedure correctly but I'm not getting any TCX file in the output folder, I can see just hitrack and json files.
This is what returns script towards to end it when throws some errors, it seems something related to speed data but I saw that this issue was solved on a earlier version of the script:
`2020-08-17 17:34:47,477 - ERROR - add_speed_data - One or more required data fields (k, v) missing or invalid in speed data [['k', '5'], ['v', '0.0']]
unsupported operand type(s) for +: 'NoneType' and 'datetime.timedelta'
2020-08-17 17:34:47,477 - ERROR - parse - Error parsing file <./output/HiTrack_20200721_204817> at line <1>
CSV data: ['tp=rs', 'k=5', 'v=0.0', '']
('One or more required data fields (k, v) missing or invalid in speed data %s\n%s', [['k', '5'], ['v', '0.0']])
2020-08-17 17:34:47,481 - ERROR - parse - Error parsing JSON file <./output/Motion path detail data & description/motion path detail data.json>
('Error parsing file <%s> at line <%d>\n%s', './output/HiTrack_20200721_204817', 1)
Traceback (most recent call last):
File "C:\Users\andre\OneDrive\Desktop\Hitrava-3.5.2\Hitrava.py", line 512, in add_speed_data
speed_data['t'] = self.start + dts_delta(seconds=int(speed_data.pop('k')) + 5)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'datetime.timedelta'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\andre\OneDrive\Desktop\Hitrava-3.5.2\Hitrava.py", line 949, in parse
self.activity.add_speed_data(data_list)
File "C:\Users\andre\OneDrive\Desktop\Hitrava-3.5.2\Hitrava.py", line 521, in add_speed_data
raise Exception('One or more required data fields (k, v) missing or invalid in speed data %s\n%s', data)
Exception: ('One or more required data fields (k, v) missing or invalid in speed data %s\n%s', [['k', '5'], ['v', '0.0']])

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\andre\OneDrive\Desktop\Hitrava-3.5.2\Hitrava.py", line 1159, in parse
hi_activity = self._parse_activity(activity_dict)
File "C:\Users\andre\OneDrive\Desktop\Hitrava-3.5.2\Hitrava.py", line 1265, in _parse_activity
hi_activity = hitrack_file.parse()
File "C:\Users\andre\OneDrive\Desktop\Hitrava-3.5.2\Hitrava.py", line 953, in parse
raise Exception('Error parsing file <%s> at line <%d>\n%s', self.hitrack_file.name, line_number)
Exception: ('Error parsing file <%s> at line <%d>\n%s', './output/HiTrack_20200721_204817', 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\andre\OneDrive\Desktop\Hitrava-3.5.2\Hitrava.py", line 1948, in
main()
File "C:\Users\andre\OneDrive\Desktop\Hitrava-3.5.2\Hitrava.py", line 1936, in main
hi_activity_list = hi_json.parse(args.from_date)
File "C:\Users\andre\OneDrive\Desktop\Hitrava-3.5.2\Hitrava.py", line 1171, in parse
raise Exception('Error parsing JSON file <%s>', self.json_file.name)
Exception: ('Error parsing JSON file <%s>', './output/Motion path detail data & description/motion path detail data.json')`

HiZip Format modified

Hi !

In my latest personal data export, it seems that the format is not the same as before.
In 'Motion path detail data & description/motion path detail data.json' there is no more recordDay ! the attributes seems to be replaced with 'startTime'

Here is an example of my latest export :

HW_EXT_TRACK_SIMPLIFY@is{\"abnormalTrack\":0,\"avgHeartRate\":113,\"avgPace\":0.0,\"avgStepRate\":0,\"bestPace\":0.0,\"bestStepRate\":0,\"britishPaceMap\":{},\"britishPartTimeMap\":{},\"chiefSportDataType\":1,\"creepingWave\":0.0,\"hasTrackPoint\":false,\"isFreeMotion\":true,\"mAvgEversionExcursion\":0,\"mAvgForeFootStrikePattern\":0,\"mAvgGroundContactTime\":0,\"mAvgGroundImpactAcceleration\":0,\"mAvgHindFootStrikePattern\":0,\"mAvgSwingAngle\":0,\"mAvgWholeFootStrikePattern\":0,\"mBritishSwimSegments\":[],\"mBritishSwolfBase\":-0.1,\"mDuplicated\":0,\"mHeartrateZoneType\":2,\"mIsNewCoordinate\":false,\"mMaxAlti\":165.5,\"mMaxSpo2\":-1,\"mMinAlti\":161.7,\"mMinSpo2\":-1,\"mSwimSegments\":[],\"mSwolfBase\":-0.1,\"mTotalDescent\":0.0,\"maxHeartRate\":140,\"minHeartRate\":88,\"paceMap\":{},\"partTimeMap\":{},\"sportDataSource\":0,\"sportType\":265,\"totalCalories\":503000,\"totalDistance\":0,\"totalSteps\":0,\"totalTime\":2809000,\"trackType\":5,\"wearSportData\":{\"record_id\":21,\"max_met\":0,\"anaerobic_exercise_etraining_effect\":0,\"load_peak\":1857578,\"etraining_effect\":20,\"recovery_time\":1585,\"extra_poc\":0,\"status\":-1}}","totalDistance":0,"duplicateTrack":0,"sportType":103,"totalTime":2809000,"timeZone":"+0200","deviceCode":141644523,"paceMap":{},"totalCalories":503000,"version":1588006829048

& before :

HW_EXT_TRACK_SIMPLIFY@is{\"abnormalTrack\":0,\"avgHeartRate\":113,\"avgPace\":0.0,\"avgStepRate\":0,\"bestPace\":0.0,\"bestStepRate\":0,\"britishPaceMap\":{},\"britishPartTimeMap\":{},\"chiefSportDataType\":1,\"creepingWave\":0.0,\"hasTrackPoint\":false,\"isFreeMotion\":true,\"mAvgEversionExcursion\":0,\"mAvgForeFootStrikePattern\":0,\"mAvgGroundContactTime\":0,\"mAvgGroundImpactAcceleration\":0,\"mAvgHindFootStrikePattern\":0,\"mAvgSwingAngle\":0,\"mAvgWholeFootStrikePattern\":0,\"mBritishSwimSegments\":[],\"mBritishSwolfBase\":-0.1,\"mDuplicated\":0,\"mHeartrateZoneType\":2,\"mIsNewCoordinate\":false,\"mMaxAlti\":165.5,\"mMaxSpo2\":-1,\"mMinAlti\":161.7,\"mMinSpo2\":-1,\"mSwimSegments\":[],\"mSwolfBase\":-0.1,\"mTotalDescent\":0.0,\"maxHeartRate\":140,\"minHeartRate\":88,\"paceMap\":{},\"partTimeMap\":{},\"sportDataSource\":0,\"sportType\":265,\"totalCalories\":503000,\"totalDistance\":0,\"totalSteps\":0,\"totalTime\":2809000,\"trackType\":5,\"wearSportData\":{\"record_id\":21,\"max_met\":0,\"anaerobic_exercise_etraining_effect\":0,\"load_peak\":1857578,\"etraining_effect\":20,\"recovery_time\":1585,\"extra_poc\":0,\"status\":-1}}","endTime":1588006819000}],"deviceCode":141644523,"source":1,"recordDay":20200427,"version":1588006829048}

The log when trying to convert it :

2020-07-07 14:20:31,380 - ERROR - parse - Error parsing JSON file <./output/Motion path detail data & description/motion path detail data.json>
'recordDay'
Traceback (most recent call last):
  File "Hitrava.py", line 1131, in parse
    activity_date = dts.strptime(str(activity_dict['recordDay']), "%Y%m%d").date()
KeyError: 'recordDay'

[SUPPORT] An exception has occurred, use %tb to see the full traceback. SystemExit: 2

Hello,

Firstly let me thank you for making this code available for everyone. As a non-computer scientist runner, I have wished many times before I had the skills to actually do what you did. As of now I have a Garmin watch that easily connects with strava, but I still have 2 years of runs in my phone in the Huawei health app that I would appreciate to have on strava and check my progress since 2017.

Anyway, I have been having trouble using your code. I have had multiple problems, I have solved most, but as of now I still don't have the output files. I don't have any errors shown in the command line when I run everything as you suggested here in github (see picture attached). However, when I open your .py file in spyder and run it, I get this error:

An exception has occurred, use %tb to see the full traceback.
SystemExit: 2

Besides, I am assuming the output file would go to the folder where the .py file and the .zip files are, right?

I know it is not much to go on, but I am happy to give you more information.
Thank you very much for your help in advance

PrintScreen
.

[SUPPORT] Getting an error during JSON parsing KeyError 'attribute'

Hello and thanks for you help in converting huawei health activities to other apps.
Just received my zipped file from huawei, extracted the JSON using password and tried converting it (only one actvity was inside).
Here is the command with output error (any idea about whta am i doing wrong?):

_**C:\Users\pontello\Desktop\huawei\Hitrava-4.0.0>python hitrava.py --json hu.json --json_export
2020-12-20 18:59:32,829 - INFO - main - Hitrava version 4.0.0 (build 2010.2902) started with arguments ['--json', 'hu.json', '--json_export']
2020-12-20 18:59:32,829 - INFO - main - Running on Python version 3.9.1
2020-12-20 18:59:32,829 - INFO - parse - Found one or more activities in JSON at index 0 to parse from 2020-12-15 (YYY-MM-DD)
2020-12-20 18:59:32,829 - ERROR - parse - Error parsing JSON file <hu.json>
'attribute'
Traceback (most recent call last):
File "C:\Users\pontello\Desktop\huawei\Hitrava-4.0.0\hitrava.py", line 1218, in parse
hi_activity = self._parse_activity(activity_dict)
File "C:\Users\pontello\Desktop\huawei\Hitrava-4.0.0\hitrava.py", line 1238, in _parse_activity
hitrack_data = activity_dict['attribute']
KeyError: 'attribute'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\pontello\Desktop\huawei\Hitrava-4.0.0\hitrava.py", line 2041, in
main()
File "C:\Users\pontello\Desktop\huawei\Hitrava-4.0.0\hitrava.py", line 2029, in main
hi_activity_list = hi_json.parse(args.from_date)
File "C:\Users\pontello\Desktop\huawei\Hitrava-4.0.0\hitrava.py", line 1233, in parse
raise Exception('Error parsing JSON file <%s>', self.json_file.name)
Exception: ('Error parsing JSON file <%s>', 'hu.json')**_

Thanks, Max

[SUPPORT] Using .tar files

Hi again,

I can't understand from the instructions if I have to crearte a .tar file with all my HiTrack files or if it is has a .tar file obtained from Huawei.

I've tried creating a .tar file with 7zip with all the Hitrack files and then execute the command as it is show in the instructions but is not working for me.

C:\Hitrava>python Hitrava.py -t huawei.tar
2020-09-24 11:03:32,720 - INFO - main - Hitrava version 3.6.1 (build 2009.1901) started with arguments ['-t', 'huawei.tar']
2020-09-24 11:03:32,720 - INFO - main - Running on Python version 3.8.6

C:\Hitrava>

The contents of the .tar file

image

Thanks for your fast answer

[QUESTION] New project

Hi.
Sorry, maybe this is wrong place to ask (can't find private email).
I just did it :) I wrote PHP script for parse Huawei motion path file to GPX.
I can't submit it to Strava now (duplicated activity) but I can read gpx from my run in GpxSee with HR and CAD.
Maybe you can give me some advices?
The last record with GPS location is:

lat = 90.0; lon = -80.0

Does it happen to you? I removed it, but I wonder if it's the watch's fault?
Do you fill empty records by last measurement sensor values โ€‹โ€‹or just put null?
I don't have any GPX files from any watch to compare data.
I have only one file from my new Huawei Band 4 Pro.
I waited about a day for my Huawei copy so it's probably not that bad.

Regards.

[SUPPORT] Example command not worked

Hi.
I tried this command from your advice:

Hitrava.py --zip HiZip.zip --json_export

and I received usage tips:

usage: Hitrava.py [-h] [-z ZIP] [-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}]

Any suggestions? What arguments are required? Why it is not worked?
I have "Motion path detail data & description\motion path detail data.json" file in zip package.

[BUG] fromdate parameter not recoginzed

if i write this command:
C:\prg\hitrava>Hitrava.py --tar com.huawei.health.tar --from_date 20190820

i get this error

usage: Hitrava.py [-h] [-z ZIP] [-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}]
Hitrava.py: error: argument --from_date: Invalid date or date format (expected YYYY-MM-DD): '20190820'.

[Mobile app] Mobile app with automatic activity upload to Strava

It's not very practical to export activities from Huawei Health then send to PC, convert using Hitrava and then upload to Strava.
Much better would be automatic export, transform and upload via mobile app. As soon as you complete an activity it should automatically be exported to Hitrava and further uploaded to Strava.

[SUPPORT] Does not work on MacOS?

It seems like the app needs 7-Zip to work (7za x -aoa ... command), but that does not exist for MacOS, from what I can see. MacOS is mentioned a few times in the readme, but there are no clear instructions how to use it properly there. I also tried with the tar.gz file, but didn't get any output generated there.

Can we please update the documentation with some clearer instructions in regards to that?

[ENHANCEMENT] Provide command line argument option to generate altitude data for every record in the TCX file to support 3rd party services.

Hi,
I'm using the Honor Magic Watch 2 to log GPS positions and altitudes. I've found out, that not every track point in a HiTrack* file has an altitude entry. Therefore after the conversion with Hitrava.py into a tcx-file not every Trackpoint element has an AltitudeMeters element. This caused problems, if the tcx-file is loaded in a program like QMapShack, to visualize the whole track on a map, because in these programs the altitude of every track point without an altitude is set to zero. So, even if you've walked in a flat area, it is possible that the program calculates that you've climbed on a hill with thousands of meters. To overcome this it would be nice if Hitrava has the possibility to interpolate the altitudes for the track points without an altitude value.

Error with Openwater Swimming Data

Dear All
Well done on providing such a useful tool in an attempt to help us get our data from Huawei onto a third party tracking site. Really appreciated. I wonder if you could help with the attached TCX file that is generated by HiTrava. Its for an outdoor swim, total time swimming 21 minutes. However when you upload it to strava it shows as completing in 2 mins!

Any ideas?

TCX file generated:

2021-01-11T11:24:55+00:00 1240 1056 0 Active Manual 2021-01-11T11:24:55+00:00 0 2021-01-11T11:24:55+00:00 35.92128270011748 14.343874950419117 2021-01-11T11:25:15+00:00 35.92126823252508 14.343795152603349 2021-01-11T11:25:35+00:00 35.921258286055505 14.343710833641282 2021-01-11T11:25:46+00:00 35.92126099872834 14.34361995906147 2021-01-11T11:25:52+00:00 35.92126506773867 14.343523659118782 2021-01-11T11:25:57+00:00 35.92127049308542 14.343428037354379 2021-01-11T11:26:00+00:00 35.921269136749004 14.343326990227098 2021-01-11T11:26:04+00:00 35.92126506773867 14.343225264963808 2021-01-11T11:26:10+00:00 35.921346447948466 14.34306996433459 2021-01-11T11:27:14+00:00 35.921393919742414 14.342956032158085 2021-01-11T11:27:16+00:00 35.921478012630395 14.342894318906382 2021-01-11T11:27:24+00:00 35.921492932337436 14.342891606277789 2021-01-11T11:27:29+00:00 35.921564818195506 14.342853628970177 2021-01-11T11:27:33+00:00 35.921609577316616 14.342770892741195 2021-01-11T11:27:37+00:00 35.92166247443485 14.342727490176397 2021-01-11T11:27:46+00:00 35.9216706124662 14.342709179743157 2021-01-11T11:27:53+00:00 35.92165026740493 14.342694260074516 2021-01-11T11:28:06+00:00 35.92161771531373 14.342635937841077 2021-01-11T11:28:13+00:00 35.92162992234365 14.34256133966698 2021-01-11T11:28:20+00:00 35.92168146314044 14.342493523106642 2021-01-11T11:28:25+00:00 35.92172893493866 14.34242299391771 2021-01-11T11:28:37+00:00 35.92175470535418 14.342336188788117 2021-01-11T11:28:52+00:00 35.92177369405978 14.342233786022987 2021-01-11T11:28:57+00:00 35.92181031514953 14.342151050047674 2021-01-11T11:29:03+00:00 35.921833372887924 14.34209883137654 2021-01-11T11:29:23+00:00 35.92183066021081 14.342047969146533 2021-01-11T11:29:33+00:00 35.921788613766815 14.341984899961032 2021-01-11T11:29:43+00:00 35.921758774352746 14.341896060423414 2021-01-11T11:29:50+00:00 35.92176148702986 14.341822818690448 2021-01-11T11:29:57+00:00 35.92179946447529 14.341755002214663 2021-01-11T11:30:02+00:00 35.92182387853512 14.341696002014327 2021-01-11T11:30:09+00:00 35.92180895882809 14.341630898251688 2021-01-11T11:30:19+00:00 35.92176013070842 14.341559012959852 2021-01-11T11:30:29+00:00 35.92174656732283 14.34148780563491 2021-01-11T11:30:36+00:00 35.92177369405978 14.34143355255575 2021-01-11T11:30:41+00:00 35.921841510919286 14.341419311023115 2021-01-11T11:30:48+00:00 35.92189440803751 14.34140100067443 2021-01-11T11:30:58+00:00 35.921937810802945 14.341358954550763 2021-01-11T11:31:02+00:00 35.92194187980151 14.34127486230343 2021-01-11T11:31:08+00:00 35.92192424745159 14.341198908026426 2021-01-11T11:31:18+00:00 35.92186456862344 14.341147367660412 2021-01-11T11:31:28+00:00 35.92179403912105 14.34111142492994 2021-01-11T11:31:35+00:00 35.92171537158731 14.341082942033786 2021-01-11T11:31:39+00:00 35.92167739414188 14.341028688785512 2021-01-11T11:31:49+00:00 35.92168417581756 14.340954768916536 2021-01-11T11:31:54+00:00 35.92173978561291 14.34086253836065 2021-01-11T11:32:03+00:00 35.92182523482233 14.340780480521344 2021-01-11T11:32:05+00:00 35.921869993909205 14.340714698622698 2021-01-11T11:32:14+00:00 35.92189033897048 14.340644847907997 2021-01-11T11:32:23+00:00 35.92185778691353 14.34056211193268 2021-01-11T11:32:28+00:00 35.92182252214521 14.340482088501403 2021-01-11T11:32:37+00:00 35.92177640670266 14.340412237786703 2021-01-11T11:32:45+00:00 35.92175063628715 14.340345099616036 2021-01-11T11:32:55+00:00 35.92176148699563 14.340279995853399 2021-01-11T11:33:15+00:00 35.92181438414809 14.340206075984423 2021-01-11T11:33:21+00:00 35.921865924979116 14.340132156115446 2021-01-11T11:33:26+00:00 35.92191475309879 14.340041282169802 2021-01-11T11:33:38+00:00 35.92192017845303 14.339957189922469 2021-01-11T11:33:48+00:00 35.92190118974743 14.339866315976826 2021-01-11T11:34:01+00:00 35.921852361627764 14.339837833249781 2021-01-11T11:34:07+00:00 35.92179675183242 14.339853431054431 2021-01-11T11:34:19+00:00 35.92176419974122 14.339901580740401 2021-01-11T11:34:39+00:00 35.92174114200282 14.339944983136084 2021-01-11T11:34:57+00:00 35.92175334903274 14.339997880112339 2021-01-11T11:35:01+00:00 35.92176013070842 14.340087397785965 2021-01-11T11:35:07+00:00 35.92177233773834 14.340179628003629 2021-01-11T11:35:15+00:00 35.92176148702986 14.340276605511576 2021-01-11T11:35:29+00:00 35.921738429291466 14.340368157593232 2021-01-11T11:35:32+00:00 35.92169638284748 14.34044818102451 2021-01-11T11:35:35+00:00 35.92167468146476 14.340527526319782 2021-01-11T11:35:45+00:00 35.92167468146476 14.340606871615051 2021-01-11T11:35:51+00:00 35.921719440585875 14.340680791484028 2021-01-11T11:35:56+00:00 35.921737072970025 14.340747251518684 2021-01-11T11:36:02+00:00 35.92174927999994 14.340779125263992 2021-01-11T11:36:22+00:00 35.92176419970698 14.340787263234322 2021-01-11T11:36:27+00:00 35.92181031514953 14.340802861038974 2021-01-11T11:36:36+00:00 35.921856430592086 14.34086050496729 2021-01-11T11:36:50+00:00 35.92189033903895 14.340955447728991 2021-01-11T11:36:53+00:00 35.9219228910959 14.341046999810642 2021-01-11T11:36:56+00:00 35.92196629386134 14.341130413921967 2021-01-11T11:37:01+00:00 35.92201919097957 14.341209080743006 2021-01-11T11:37:12+00:00 35.9220815824506 14.341270115351369 2021-01-11T11:37:16+00:00 35.92212498521604 14.341335897080903 2021-01-11T11:37:28+00:00 35.92212769785892 14.341395575248137 2021-01-11T11:37:38+00:00 35.92210328379908 14.34147695461321 2021-01-11T11:37:50+00:00 35.92209378944628 14.34155494312913 2021-01-11T11:37:58+00:00 35.922118203506116 14.341638357071343 2021-01-11T11:38:09+00:00 35.92212227250467 14.34168582828308 2021-01-11T11:38:19+00:00 35.92211277815188 14.341739403057122 2021-01-11T11:38:37+00:00 35.92207615702789 14.341798403088346 2021-01-11T11:38:44+00:00 35.922063949963736 14.341893345680932 2021-01-11T11:38:49+00:00 35.92205852460949 14.341990322850657 2021-01-11T11:38:54+00:00 35.9220395359039 14.342056782716204 2021-01-11T11:39:06+00:00 35.9220029147799 14.342117817324564 2021-01-11T11:39:19+00:00 35.92194459230744 14.342182242782084 2021-01-11T11:39:32+00:00 35.92191068389481 14.342281932664957 2021-01-11T11:39:42+00:00 35.92187948812505 14.342380944411818 2021-01-11T11:39:52+00:00 35.92184151067962 14.342452151567647 2021-01-11T11:39:59+00:00 35.92177640649724 14.34250030116906 2021-01-11T11:40:05+00:00 35.921749279760284 14.342536922035546 2021-01-11T11:40:24+00:00 35.92173978540748 14.342591175199264 2021-01-11T11:40:32+00:00 35.92174656708316 14.342664416932228 2021-01-11T11:40:41+00:00 35.92172079666765 14.342753934605858 2021-01-11T11:41:00+00:00 35.921678750223656 14.342827854559388 2021-01-11T11:41:09+00:00 35.9216231404283 14.342885498572262 2021-01-11T11:41:15+00:00 35.921564817938716 14.342941786313116 2021-01-11T11:41:22+00:00 35.92152141515617 14.342995361425379 2021-01-11T11:41:42+00:00 35.92148208138929 14.343042154923888 2021-01-11T11:42:02+00:00 35.9214305405925 14.343075385110325 2021-01-11T11:42:07+00:00 35.92136272375012 14.343113362502496 2021-01-11T11:42:17+00:00 35.92129761958057 14.34316693774159 2021-01-11T11:42:26+00:00 35.92124879145662 14.343239501761328 2021-01-11T11:42:29+00:00 35.92120810135119 14.343319525657662 2021-01-11T11:42:38+00:00 35.921193181644156 14.343405653116303 2021-01-11T11:42:51+00:00 35.921185043621364 14.343482286248035 2021-01-11T11:43:11+00:00 35.92117419293 14.343557563023197 2021-01-11T11:43:29+00:00 35.921138928178806 14.343625379964038 2021-01-11T11:43:34+00:00 35.92107382401354 14.343680311707681 2021-01-11T11:43:38+00:00 35.9210046508326 14.343726427281569 2021-01-11T11:43:52+00:00 35.92093547765165 14.343770508384013 2021-01-11T11:43:58+00:00 35.92087444250206 14.343816624037169 2021-01-11T11:44:04+00:00 35.92085952279502 14.343853245321146 2021-01-11T11:44:14+00:00 35.920864948149266 14.343834934676517 2021-01-11T11:44:31+00:00 35.92088393685486 14.34377186467717 2021-01-11T11:44:37+00:00 35.92086901714782 14.34373659974448 2021-01-11T11:44:52+00:00 35.92083782141231 14.343763726622283 2021-01-11T11:44:55+00:00 35.92079441864688 14.343846463633406 2021-01-11T11:45:02+00:00 35.920784924294075 14.343908177339594 2021-01-11T11:45:14+00:00 35.92080526935535 14.343965822018342 2021-01-11T11:45:24+00:00 35.920829683415185 14.344025501200242 2021-01-11T11:45:35+00:00 1056 Huawei Fitness Tracking Device 0000000000 0000 0 0 0 0 Hitrava 4 0 2010 2902 en 000-00000-00

[SUPPORT] File conversion not working

I've executed Hitrava trhough command line to conver one file and anything happens. I don't get any error message and the TCX is not generated.

Here's what I write in cmd:

python Hitrava.py -f HiTrack_1598504245000159851650400030001

Thanks for your help

Encountered an unknown sport type? Need your help.

I'm looking for people who have running, pool swimming or open water swimming activities in Huawei Health that use the ZIP or JSON conversion.

I'm in search of the HiTrack sport type codes for these types of activities in the HiTrack JSON data.
You can provide me with the information as follows:

  1. Run the program with the --json_export command line argument (this is the case when using the Run_Hitrava.cmd batch file).
  2. For any activity of one of the above mentioned sport types, open the corresponding .json file that was generated with your favorite text editor. You will see something like this;

[{"motionPathData": [{"sportType": ?,

  1. There will be a number where the question mark is. I would require the activity type and that number.

Thank you for helping out.

Calories

Hello,
about calories data from JSON.

Calories are stored as cal (calories) in JSON data.
But Histrava convert it to kcal (kilocalories, Cal).

I don't know what's right...

[BUG]

Got following error when was trying to convert Data to Strava compatible files
Have about 20 activities available but converted only first 4 of them

2020-06-21 09:41:23,244 - ERROR - generate_xml - Error generating TCX XML content for activity <HiTrack_20200205_195225>
local variable 'segment_calories' referenced before assignment
Traceback (most recent call last):
  File "Hitrava.py", line 1401, in generate_xml
    self._generate_swim_xml_data(el_activity)
  File "Hitrava.py", line 1522, in _generate_swim_xml_data
    el_lap = self._generate_lap_header_xml_data(el_activity, lap)
  File "Hitrava.py", line 1576, in _generate_lap_header_xml_data
    el_calories.text = str(segment_calories)
UnboundLocalError: local variable 'segment_calories' referenced before assignment

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "Hitrava.py", line 1897, in <module>
    main()
  File "Hitrava.py", line 1892, in main
    tcx_activity.save()
  File "Hitrava.py", line 1587, in save
    self.generate_xml()
  File "Hitrava.py", line 1452, in generate_xml
    raise Exception('Error generating TCX XML content for activity <%s>\n%s', self.hi_activity.activity_id, e)
Exception: ('Error generating TCX XML content for activity <%s>\n%s', 'HiTrack_20200205_195225', UnboundLocalError("local variable 'segment_calories' referenced before assignment"))

[BUG]

Describe the bug
If I download the data from Huawei and rename it as HiZip.zip, I get this error:

C:\Users\cretua\WORK\Hitrava-3.2.5>python Hitrava.py --zip HiZip.zip --json_export
2020-04-17 12:46:14,301 - WARNING - extract_json - Could not find JSON file <data/Motion path detail data & description/motion path detail data.json> in ZIP file <HiZip.zip>. Nothing to convert.
Traceback (most recent call last):
File "Hitrava.py", line 1746, in
main()
File "Hitrava.py", line 1730, in main
json_filename = HiZip.extract_json(args.zip, args.output_dir)
File "Hitrava.py", line 1022, in extract_json
raise Exception('Could not find file <data/motion path detail data.json> in ZIP file <%s>.
Exception: ('Could not find file <data/motion path detail data.json> in ZIP file <%s>. Nothing to convert.', 'HiZip.zip')

If I extract "motion path detail data.json" and I try to convert it I get this error:

PS C:\Users\cretua\WORK\Hitrava-3.2.5> python Hitrava.py --json '.\motion path detail data.json' --json_export
2020-04-17 12:50:40,404 - INFO - parse - Found one or more activities in JSON at index 0 to parse from 2018-09-02 (YYY-MM-DD)
2020-04-17 12:50:40,405 - INFO - parse - Exporting JSON data of activity at index 0 from 2018-09-02 to file ./output/HiTrack_20180902_135312.json
2020-04-17 12:50:40,407 - INFO - parse - Saving activity at index 0 from 2018-09-02 to HiTrack file ./output/HiTrack_20180902_135312 for parsing
2020-04-17 12:50:40,416 - INFO - parse - Parsing file <./output/HiTrack_20180902_135312>
2020-04-17 12:50:40,428 - ERROR - parse - Error parsing JSON file <.\motion path detail data.json>
'wearSportData'
Traceback (most recent call last):
File "Hitrava.py", line 1185, in parse
if 'swim_pool_length' in activity_detail_dict['wearSportData']:
KeyError: 'wearSportData'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "Hitrava.py", line 1746, in
main()
File "Hitrava.py", line 1736, in main
hi_activity_list = hi_json.parse(args.from_date)
File "Hitrava.py", line 1198, in parse
raise Exception('Error parsing JSON file <%s>', self.json_file.name)
Exception: ('Error parsing JSON file <%s>', '.\motion path detail data.json')

[SUPPORT] Error during extraction of files.

Hello. While running the extraction file, I'm getting the following message.

Info - External library xmlschema could not be imported.
It is required when using the --validate_xml argument.
It can be installed using: pip install xmlschema
2020-07-05 18:35:21,708 - INFO - parse - Found one or more activities in JSON at index 0 to parse from 2020-06-21 (YYY-MM-DD)
2020-07-05 18:35:21,708 - INFO - parse - Exporting JSON data of activity at index 0 from 2020-06-21 to file ./output/HiTrack_20200621_170812.json
2020-07-05 18:35:21,708 - INFO - parse - Saving activity at index 0 from 2020-06-21 to HiTrack file ./output/HiTrack_20200621_170812 for parsing
2020-07-05 18:35:21,740 - INFO - parse - Parsing file <./output/HiTrack_20200621_170812>
2020-07-05 18:35:21,740 - ERROR - add_speed_data - One or more required data fields (k, v) missing or invalid in speed data [['k', '5'], ['v', '0.0']]
invalid literal for int() with base 10: '0.0'
2020-07-05 18:35:21,740 - ERROR - parse - Error parsing file <./output/HiTrack_20200621_170812> at line <9>
CSV data: ['tp=rs', 'k=5', 'v=0.0', '']
('One or more required data fields (k, v) missing or invalid in speed data %s\n%s', [['k', '5'], ['v', '0.0']])
2020-07-05 18:35:21,740 - ERROR - parse - Error parsing JSON file <./output/Motion path detail data & description/motion path detail data.json>
('Error parsing file <%s> at line <%d>\n%s', './output/HiTrack_20200621_170812', 9)
Traceback (most recent call last):
File "C:\Hitrava\Hitrava.py", line 511, in add_speed_data
speed_data['rs'] = int(speed_data.pop('v'))
ValueError: invalid literal for int() with base 10: '0.0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Hitrava\Hitrava.py", line 949, in parse
self.activity.add_speed_data(data_list)
File "C:\Hitrava\Hitrava.py", line 519, in add_speed_data
raise Exception('One or more required data fields (k, v) missing or invalid in speed data %s\n%s', data)
Exception: ('One or more required data fields (k, v) missing or invalid in speed data %s\n%s', [['k', '5'], ['v', '0.0']])

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Hitrava\Hitrava.py", line 1234, in parse
hi_activity = hitrack_file.parse()
File "C:\Hitrava\Hitrava.py", line 953, in parse
raise Exception('Error parsing file <%s> at line <%d>\n%s', self.hitrack_file.name, line_number)
Exception: ('Error parsing file <%s> at line <%d>\n%s', './output/HiTrack_20200621_170812', 9)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Hitrava\Hitrava.py", line 1899, in
main()
File "C:\Hitrava\Hitrava.py", line 1886, in main
hi_activity_list = hi_json.parse(args.from_date)
File "C:\Hitrava\Hitrava.py", line 1278, in parse
raise Exception('Error parsing JSON file <%s>', self.json_file.name)
Exception: ('Error parsing JSON file <%s>', './output/Motion path detail data & description/motion path detail data.json')

Therefore, I'm not getting the files converted. Don't know if there's an issue with the downloaded files, or whether it's because they're being taken from a Band 4 Pro.

[LINK REMOVED]

[BUG]

Describe the bug
A clear and concise description of what the bug is.
C:\Hitrava-4.0.0>Hitrava.py --zip HiZip.zip --password ******** --json_export
Info - External library xmlschema could not be imported.
It is required when using the --validate_xml argument.
It can be installed using: pip install xmlschema
2020-11-02 11:53:54,178 - INFO - main - Hitrava version 4.0.0 (build 2010.2902) started with arguments ['--zip', 'HiZip.zip', '--password', '********', '--json_export']
2020-11-02 11:53:54,178 - INFO - main - Running on Python version 3.9.0
2020-11-02 11:53:54,178 - ERROR - extract_json - Invalid ZIP file or ZIP file not found <HiZip.zip>
Traceback (most recent call last):
File "C:\Hitrava-4.0.0\Hitrava.py", line 2041, in
main()
File "C:\Hitrava-4.0.0\Hitrava.py", line 2023, in main
json_filename = HiZip.extract_json(args.zip, args.output_dir, args.password)
File "C:\Hitrava-4.0.0\Hitrava.py", line 1128, in extract_json
raise Exception('Invalid ZIP file or ZIP file not found <%s>', zip_filename)
Exception: ('Invalid ZIP file or ZIP file not found <%s>', 'HiZip.zip')
Logs
If applicable, add logging and error information from the application.
To enable full logging, add the command line argument --log_level DEBUG when running the program.

Files
If applicable, add relevant input and output files (by dragging them here).
For JSON conversions, you can use the --json_export command line argument. This will generate a separate .json file with the original Huawei HiTrack data for each activity that you can add here.

Note: be aware that your fitness activity files (may) contain personal data. We will notify that you can remove the attached files from your report as soon as we have downloaded them. We will ONLY use the files for debugging purposes.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

[BUG]Most data not converted to tcx files

Describe the bug
I gat very less tcy files from by collected Huawei data. There are hundreds of json files but only a few tcx files. I filtered out 2020 and tthere are many tracks missing for sure.

Logs
2020-09-19 12:27:34,500 - DEBUG - generate_xml - Generating TCX XML data for activity HiTrack_20200104_155538 2020-09-19 12:27:34,500 - INFO - _calc_pool_swim_data - Calculating swim data for activity HiTrack_20200104_155538 2020-09-19 12:27:34,500 - ERROR - generate_xml - Error generating TCX XML content for activity <HiTrack_20200104_155538> 'NoneType' object is not iterable Traceback (most recent call last): File "Hitrava.py", line 1466, in generate_xml self._generate_swim_xml_data(el_activity) File "Hitrava.py", line 1594, in _generate_swim_xml_data for n, lap in enumerate(self.hi_activity.get_swim_data()): File "Hitrava.py", line 786, in get_swim_data return self._calc_pool_swim_data() File "Hitrava.py", line 823, in _calc_pool_swim_data for n, segment in enumerate(self._segment_list): TypeError: 'NoneType' object is not iterable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "Hitrava.py", line 2009, in <module> main() File "Hitrava.py", line 2004, in main tcx_activity.save() File "Hitrava.py", line 1662, in save self.generate_xml() File "Hitrava.py", line 1517, in generate_xml raise Exception('Error generating TCX XML content for activity <%s>\n%s', self.hi_activity.activity_id, e) Exception: ('Error generating TCX XML content for activity <%s>\n%s', 'HiTrack_20200104_155538', TypeError("'NoneType' object is not iterable")) 2020-09-19 12:27:34,539 - DEBUG - _close_json - JSON file <2020/Motion path detail data & description/motion path detail data.json> closed

Files
If applicable, add relevant input and output files (by dragging them here).
For JSON conversions, you can use the --json_export command line argument. This will generate a separate .json file with the original Huawei HiTrack data for each activity that you can add here.

Note: be aware that your fitness activity files (may) contain personal data. We will notify that you can remove the attached files from your report as soon as we have downloaded them. We will ONLY use the files for debugging purposes.

Screenshots
If applicable, add screenshots to help explain your problem.
HiTravat

Additional context
Im mostly interested in my bicycle tracks. Bought a race bike this year and from february to may, I used my Huawei Band 2 to track my rides. But I get only twoi tcx files. There should be dozens of files.

Help with web upload

Hi,

I just tried out your web upload and it seems to load my huawei health activities up to the 15th December. After this date the activities are shown but I cannot select them to convert. See attached screen shot.

Please can you check if something has changed in the file format?
I just retrieved my first file today.
Many thanks, site looks good if i can get my recent data to upload.
HitravaWeb

Ian

[FEATURE] Conversion from .tar/ individual HiTrack_ file results in a .tcx filename with unix timestamp datetime instead of human readable

Is your feature request related to a problem? Please describe.
When converting a single file named "HiTrack_1594228021000159422864000030001" the output file is named "HiTrack_1594228021000159422864000030001.tcx" which is pretty ugly to read.
I can use a format of --output_file_prefix "%Y-%m-%d %H-%M-%S " to get an output of "2020-07-08 17-07-02 HiTrack_1594228021000159422864000030001.tcx" but this is way too long and still ugly.

The .zip from huawei data is nicely converted to files with format "HiTrack_20200708_200701_001.tcx" which is very readable, and sorts nicely in explorers (also converted to correct timezone, nice touch there!).

Describe the solution you'd like
My request is to treat HiTrack files the same as .json type for output, so something like this:
HiTrack_"timestamp_start""timestamp_end" --> HiTrack_YYYYMMDD_HHMMSS.tcx

Note: same request for .tar processing.

Additional context
For context: I requested my data from huawei a few weeks ago and succesfully used Hitrava on that .zip to get the activities. Today I wanted to re-redownload the latest data but they have a timeout period in which you can't re-request your data again so I used an android emulator, rooted it, installed huawei health in it and got my data this way after syncing to cloud. The result wasn't as nicely as a few weeks back and I think this change would be very quick and useful.

Thanks,
Daniel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.