Extending the life of TomTom wearables

 

TomTom recently announced it would stop operating their supporting infrastructure by the end of September following its earlier decision to exit the wearables market. This means that its products, such as sports watches, will become effectively useless, as they will no longer be able to export their activities and sync them with tracker sites. Throwing away an otherwise fine watch only because its maker decided to shut down its proprietary infrastructure seems like a sad waste. Here is how you can download the watch’s data and upload it to Strava, a popular activity tracker, using open source software.

For downloading activity data from the watch you can use the Ryan Binns’s ttwatch program. This runs on Linux systems. If you want to upload your data through a Windows computer, a pull request a contributed allows it to work on Cygwin in conjunction with Microsoft’s Winusb driver. The PR involves an update in the CMake configuration file, a fix to get around a clash between curl and Libusb, and instructions for compiling and deploying under Windows. The curl/Libusb clash was a difficult to isolate compiler error. I found the root cause by examining the C compiler’s preprocessor output and pinpointed the culprit by creating a minimal test file followed by the successive (divide and conquer) elimination of header files. (I detail all three techniques in my book Effective Debugging.)

For uploading the activity data obtained from the watch to Strava you can use a fork I developed based on Matti Pöllä’s stravaup program. This involved updates to support Strava’s new authentication API and a small Python server to automate the authorization code retrieval process. Interestingly, the server’s code came mostly from ChatGPT, which greatly sped up its development. Otherwise, I don’t think I would have considered it worthwhile to invest the required time on that task.

Finally, for integrating the two tasks you can configure the ttwatch program to run a post-processing script that will upload the downloaded data to Strava. The configuration is done by adding the script’s full path to the PostProcessor setting in the .ttwatch configuration file. Here is a Unix shell script that can perform the automatic upload.


#!/bin/sh
#
# Post-processor called by ttwatch to upload the downloaded activity to Strava
#

# Ignore activity summaries
if [ ${1##*.} = protobuf ] ; then
  exit 0
fi

# Convert the downloaded file from binary to TCX format
ttbincnv --tcx "$1"

# Upload TCX file to Strava
stravaup $(basename "$1" .ttbin).tcx

Based on this setup you can upload your watch’s activities using the command ttwatch --get-activities. While at it, you might also want to run ttwatch --update-gps --set-time --get-summaries to update the watch’s GPS ephemeris data, time, and also get activity summaries. You can of course package these commands in another shell script or alias to speed up the process.

One risk of this setup is that the GPS ephemeris data, which speeds up the watch’s GPS startup, is still obtained from TomTom through this URL. If TomTom decides to stop providing this data as well, then we (the open source software community) will need to reverse engineer the data’s format and find a way to create the file from publicly available GPS data sources, such as those made available by the International GNSS Service.

Comments   Toot! Share


Last modified: Friday, November 3, 2023 5:57 pm

Creative Commons Licence BY NC

Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.