Friday, September 11, 2015

Garmin fenix3

What to do with activities?

One of the cool features the fenix3 provides is the wireless lan module. I really don't wanna miss this. Once you have added your available WLAN networks (I added my home network and my  smartphone wifi tethering hotspot) and wifi auto-upload is enabled on your watch, the fenix3 will periodically try to connect to your network once a new activity has been saved.
Cool ... so after a run upon entering my house the activity is basically already uploaded to Garmin Connect.

Strava and Garmin Connect (GC)

So far so good ... the thing is some years ago I was searching for some online portal to upload my running activities (backup, stats, fun, for whatever reason ...), that time I came along strava.com. One thing they had (way before garmin connect) were the so called 'segments' for runs and bike rides and associated 'koms'. Along with segments also comes a leaderboard.
Long story made short so far I was using strava not garmin connect (GC). In the past I manually uploaded my .fit files to the strava page, of course this will still work but since now everything can automatically appear in GC it makes sense this gets automatically to strava as well.
So how to do this? Simple ... strava provides the option to sync GC ... no big deal ...
Unfortunately it just did not work for me so far ... not sure why.
So I was looking for some other way to download files from GC and upload again to strava.
I found garmin-connect-export and made some minor enhancements. Once you have a .fit file you can use strava api to upload this file and it will appear on your dashboard.
To do so I make use of the node.js strava module, you can find this script and description here.


So my current "workflow" is:
  1. go running/cycling/swimming and return back home (or turn on mobile hotspot)
  2. run gcexport.py -d ~/MyActivities -c 5 -u (optionally provide user/pwd on cmdline)
  3. node strava-file-upload.js  -f ~/MyActivities/895146395.fit

TODO

Automate the steps 2 and 3 from above. Right now my idea is to monitor my wlan traffic and trigger some script once an activity upload is detected. The script should do the GC download and strava upload.

Maybe something like this (where 12:34:56:78:9A:BC is your watch mac address):
tcpdump -i wlan0 ether host 12:34:56:78:9A:BC | awk '{if (some condition) {system("somescript")}}'


And since I have now installed runalyze on my server I want to sync to this one as well ... but should not be a big deal ... especially since runalyze is open source (see also my fork).