huawei watch gt- export data from health

grlazy

Member
Apr 26, 2007
23
9
3
Got the Huawei watch GT some days ago.
Everything is good except the fact that i can't get track data from Google fit (i know about the issue since they did update the app) and there isn't a way to get the data straight from huawei health.
So i rooted my phone (Xiaomi natrium) and found out the attached file at the path /data/data/com.huawei.health/files.

I can see the latitude/longtitude/time entries and their count.At the bottom it has the HRM and the altitude.

I am sure is a gps location log file of some kind but i can't understand and i am not a developer. Maybe it is a proprietary log file ?
Can anyone help ?
Is there any kind of converter to .GPX ?
 

Attachments

Last edited:

*Invader Zim*

New member
Dec 3, 2018
0
1
0
My problem is the calorie count is not your daily count, but rather your activity count which is completely useless.

Also, if I sync with Google Fit the heart rate does not pull through.
 
  • Like
Reactions: marriusf81

ethgkk

New member
Jan 22, 2019
1
2
0
Got the Huawei watch GT some days ago.
Everything is good except the fact that i can't get track data from Google fit (i know about the issue since they did update the app) and there isn't a way to get the data straight from huawei health.
So i rooted my phone (Xiaomi natrium) and found out the attached file at the path /data/data/com.huawei.health/files.

I can see the latitude/longtitude/time entries and their count.At the bottom it has the HRM and the altitude.

I am sure is a gps location log file of some kind but i can't understand and i am not a developer. Maybe it is a proprietary log file ?
Can anyone help ?
Is there any kind of converter to .GPX ?
Hi,

Just checked shortly your file and found a few things: if you import it to excel as delimited by semicolon, you can do the necessary conversions, needed to use Excel GPX converter. I am not allowed to post links here, so please search for the site. Please check the requirements how to name the Excel columns!
What shall you do?
- e.g remove lat=, lon=, from the beginning of the coordinates - for 18119 points
- tp=alti rows contains the altitudes, again remove the 'v=' before the value - for 3560 points
- tp=h-r contains the heart rate, again remove the 'v=' before the value - for the same 3560 points
- tp =rs contains the average speed for the same 3560 points, again remove the 'v=' before the value. Speed is most probably m/s.
- tp=s-r - i have no idea what is this, but can be identified if you share what kind of activity you did and where
- tp=p-m - no idea
- tp=b-p-m - no idea
- In case of speed - it is calculated for every 5th point, so you must copy speed values with k=0 to an additional column right to the coordinates, like this: speed for k=0 you copy to coordinates from k=0, k=1, k=2, k=3, k=4, continue with k=5, etc. in the same way.
- Due to the fact that we have Heart Rate and altitude records in the same amount as speed, I guess we have to do the same (add two more columns to the excel and copy the same way). I have no idea, what those huge k values mean at the beginning of the rows, my best guess is a coded time stamp, the difference is always 5000. Half second? 5 second? Can you tell me when you made that track (date and time)?

It's OK, if you convert just e.g. 10-20 records and skip the rest, just to check if the theory is correct or not.
At the end you must remove the columns which contain just type and sequence information (first two). Please also be sure that at the end no formulas remained in the excel, just simple values. Run the GPX export, try to import it to Strava.

If it does not work, download a GPX file from Strava open in Excel as xml and check what is the difference. Fine-tune the excel conversions accordingly and it will work sooner or later. If you can share the final working method here, I will really appreciate it!

I might buy a Honor Magic Watch or a Huawei Watch GT. If that happens, I will write a conversion program to avoid manual work in Excel.

Best regards,
Gabor
 
Feb 27, 2019
17
17
0
Well done finding this file - it looks like it might finally be a step in the right direction for getting this data out of the Huawei Health app! I'm going to give this a go with data from a Huawei Band 2 Pro.

Regarding the huge time-stamp, I suspect it's simply the number of seconds since the unix epoch, written in scientific notation. For example the first timestamp (t=1.543646826E9) written without scientific notation becomes (1543646826) which corresponds to (Sat, 1 Dec 2018 06:47:06 GMT).

I'm going to try and access this file without rooting my phone, hopefully by "backing-up" the app-data to my computer using ADB. I'm reluctant to root my phone as I don't want to lose the ability to use Google Pay. I'll keep you updated!
 
Feb 27, 2019
17
17
0
Update: I could neither debug nor backup the Huawei Health app (Version: 9.0.4.332) on my unrooted Huawei P10 Lite. A workaround might be to backup the Health data to the Huawei cloud and re-download it onto a different rooted handset, but as I don't have a rooted handset at the moment I can't do that. Another workaround might to be trying to download an older version of the app, and hoping that it doesn't restrict backup/debugging. Another option might be to use the HiSuite application to backup the data to your computer and extract the health data from there. I'm trying all these options to avoid rooting.
 
Last edited:
Feb 27, 2019
17
17
0
Why does not Huawei put the option to export to gpx in the Health application?
I wish! There is an open question on the Huawei forums for this - it's probably worth adding your voice to the crowd to push it up their priority list :)

I have found a way to access the data without a rooted phone though!!
  • Download the Huawei Backup app (previously called KoBackup)
  • Make a local backup to an SD card of just the Huawei Health App Data (ensuring that the backup is not encrypted)
  • Navigate to the backup on your SD card and you'll find a .tar file containing the data files posted above. You can then move this across to your computer for processing.
  • The relevant files start `HiTrack_` then a unix timestamp, and can be found in `com.huawei.health/files/`

It is currently not possible to use the HiSuite to extract this data directly to your computer as it is encrypted, even if you choose not to use a password. There are some expensive commercial tools that can decrypt the data (MOBILedit Forensic Express), and a new paper (doi: 10.1016/j.diin.2019.01.008) has been released that proposes a framework for doing this but they don't supply the tool that they've created.


So now we just need to work on converting this data to a useful format, such as Garmin's .tcx- I'll try and whip up a python tool to do this so that it can be cross-platform. I have no experience working with XSD Schema so any help would be appreciated!
 
Last edited:
Feb 27, 2019
17
17
0
I've not forgotten about this and am working on it - I've wrapped my head around generating .tcx files and can generate valid ones in python now based on very simple data. Now I'm working on parsing the HiTrack files in order to feed them in to my .tcx generator.

I have noticed that my backed-up com.huawei.health folder doesn't always hold all of my recorded tracks. It doesn't even seem to only store the recent ones, but a somewhat random selection. I'm beginning to think that these files aren't how the data is stored long-term, but something that the app is producing as temporary files in order to make displaying the information easier/faster. This might be a pain later on, but for now it's better than nothing.

I've also noticed that our files are slightly different, probably because mine is generated using a Huawei Band 2 Pro rather than the Watch GT. Again, this is a problem for later on - perhaps altitude measurements from your watch won't transfer across initially (mine has no altitude measurement), but with enough data files from you I'll be able to sort that.

I've worked out that the tp=p-m lines store your pace (the number of seconds it took you to run that particular kilometer), and on these lines k is distance run in micrometers (!?). I still have no idea what tp=b-p-m but it's probably also measured in micrometers. We can calculate pace from our timestamped location data so I'm going to ignore these lines.

Finally, the timestamps associated with location and heart-rate measurements are not the same, meaning we will need to interpolate heart-rates for the locations that we do have recorded. For the moment I'll just ignore heart-rate data, and that can be a problem for later on.
 
Last edited:
Feb 27, 2019
17
17
0
Is there any kind of converter to .GPX ?
There is now!



I noticed whilst processing your data that you have 4 or 5 incorrectly recorded GPS points that pointed at:

Code:
lat=90.0;lon=-80.0
Once I'd stripped these out by hand the conversion went smoothly.

I'll implement some kind of filter that removes lines that contain these coordinates during conversion so that you don't have to do this by hand in the future. I don't think those coordinates will crop up in real run data, as they're in the middle of the arctic ocean...

EDIT: Done, you can now filter these records out by passing the tool the command line argument '-f' (see readme for details).
 
Last edited:
Feb 27, 2019
17
17
0
@ aricooperdavis
those are very good news, thank you so much for your time and effort .
I will test it asap (most likely at weekend ) and report back
My pleasure! If you have any trouble send me the files and errors and I can troubleshoot :)

---------- Post added at 06:02 PM ---------- Previous post was at 05:59 PM ----------

I'm just missing cadence. Could you implement it?
I'll see if I can add it :) At the moment I'm not interpolating the heart-rate, I'm just putting it in where it appears, so I can do the same for cadence?
 
Last edited:

majo_scigo

Senior Member
May 28, 2006
109
8
0
UK
not sure if it is going to help, but I found by chance that you can request your data from Huawei. Just click your picture in the health app click setting/ request your data. you will be asked to confirm your mobile and they will email it to you. I have done it the other day and got the data within few hours. If someone wants, i am happy to share over a year of my data from Huawei Band 2 (my steps, sleep and heart rate, plus couple of gps routes)
Just to add all the info is generated in .xml format.
 

Attachments

Last edited:
Feb 27, 2019
17
17
0
exactly. I compared HR and everything is correct.
There you go, I've updated it :)

Can you have a look and see if that's worked for you? The TCX schema for cadence is a bit complicated; there is a <Cadence> tag for each trackpoint but according to Strava this isn't used for Running; instead you need to use the <RunCadence> extension. This is what I've done, and the files validate happily enough, but I'm not 100% sure that tools like Strava will recognize them. Let me know if this is a problem.
 
Last edited:
  • Like
Reactions: trebllaw
Feb 27, 2019
17
17
0
not sure if it is going to help, but I found by chance that you can request your data from Huawei. Just click your picture in the health app click setting/ request your data. you will be asked to confirm your mobile and they will email it to you. I have done it the other day and got the data within few hours. If someone wants, i am happy to share over a year of my data from Huawei Band 2 (my steps, sleep and heart rate, plus couple of gps routes)
Just to add all the info is generated in .xml format.
Thank you - that's potentially very useful for iPhone users who aren't currently able to access these HiTrack files, although it is a shame that you can only request your data once per month. I have requested a copy of my data too; hopefully it will be possible to adapt the tool, or make a new one, that can process these .xml files directly in order to generate .tcx files of activities :good:
 

lio_pawel

Member
Oct 18, 2010
6
4
0
There you go, I've updated it :)

Can you have a look and see if that's worked for you? The TCX schema for cadence is a bit complicated; there is a <Cadence> tag for each trackpoint but according to Strava this isn't used for Running; instead you need to use the <RunCadence> extension. This is what I've done, and the files validate happily enough, but I'm not 100% sure that tools like Strava will recognize them. Let me know if this is a problem.
Thank you very much for your work. Cadence is here, but the distance has disappeared. The TCX Conventer after loading the file generated by your program, does not show the distance and I can not add the altitude. In the previous version it worked great.

---- Input File ----
reading: OKAY
filtering: OKAY
processing gps: OKAY
processing heart-rate/cadence: OKAY

---- Details ----
start: 2019-02-16 14:00:50
duration: 00:24:46
distance: 0m
sport: Running

---- XML file ----
generating: OKAY
saving: OKAY
validating: OKAY
 
  • Like
Reactions: aricooperdavis

lio_pawel

Member
Oct 18, 2010
6
4
0
:eek:!?!?!



I can't replicate that problem - can you send me your HiTrack file? You can upload it here or as an issue on GitHub! Thank you!


I uploaded two files. One is correctly processed, the other is missing a distance. Before adding cadence, all files were correct. In my files there is also a altitude at the end of the file. This is probably the last thing missing.
 
Last edited:
  • Like
Reactions: trebllaw