Jul 282020
 

Anyone who owns a Garmin watch, bike computer or other activity logging computer can’t have failed to notice the 3 day outage on Garmin Connect over the weekend of 24-26th July 2020. Being denied access to a large portion of my data made me swiftly evaluate my (lack of) backup strategy. I expect it also forced quite a lot of people to dig out their USB cables to upload activities to Strava.

I have most of the more recent activity data (bike rides and walks) still on my devices, but a whole year’s worth (June 2018 to July 2019) was not backed up anywhere else at all. So I vowed to rectify this grievous evil the moment Garmin Connect came back online, which happened on Monday 27th (the day of writing this).

Why the Urgency?

Well the rumours on the internet say that Garmin was a victim of ransomware. If a tech company that large can get taken down, anyone can. So any data you care about, you should have control of (or at least a backup copy under your control).

It looked as if I was going to have to struggle with something like 400 individual activities, downloading each .fit or .tcx file separately and manually. YUCK! How boring, and what a waste of time. If only someone had written some code to automate this for us. Worth a look I suppose? So I looked.

And I found GarminExport on Github.

https://github.com/petergardfjall/garminexport

Looks Promising

It looked like it might do the trick, so I installed it on a Raspberry Pi 4 with…

pip3 install garminexport

…then add home/pi/.local/bin to the path by editing ~/.profile
nano ~/.profile

…and add this line at the end…
PATH=$PATH:home/pi/.local/bin

Then logout and log back in again to activate the changes.

Now Download Your Data

After that, the following command will download all your activities to a [new] directory called “activities” (or whatever you choose). You will need to change your_id_or_email to your Garmin Connect login ID. And you will also be asked for your password as a second step, so have that ready too.

garmin-backup --backup-dir=activities your_id_or_email --format fit

It took about 15 minutes to download all 844 of my activities as .fit files. I was mighty chuffed. I sftped them via my Mac to a portable USB drive, but left them still on the Pi too.

You can use the same command to do an incremental backup as well. garminexport will ignore any files it has already backed up in the specified directory.

Downloading TCX files from my Garmin Connect account

Downloading TCX files from my Garmin Connect account

Other Formats Too

If you prefer gpx or tcx files, you can change --format fit to e.g. --format tcx
If you omit the --format option it will download all available variants.

.fit are the original raw data files straight from the Garmin device. .tcx and .gpx are processed and in a different format. I found .tcx took slightly longer to download. But none of the files contain any of the notes you may have written on Garmin Connect. It would appear that you can’t back those up independently this way.

Can Now Complete My Strava Records

The added bonus here is that I now have all the files I need, should I wish to have a complete activity record on Strava or any other platform in the future. When you first sign up for Strava it allows a mass import from Connect, but only takes something like the 150 or 250 most recent activities. If you have more history than that and you want them all, you have to upload them yourself (in batches of <=25). Well at least now I have the files if I choose to do that. 400 / 25 is still a lot of iterations though. I wonder if anyone's written software to automate that process?

  One Response to “Back up your Garmin activity data on a Raspberry Pi”

  1. Hello Alex, great pleasure your e-mail, you thought my thoughts! Best regards.

Leave a Reply