Git Product home page Git Product logo

suunto2strava's Introduction

Suunto2Strava

"Because the cycling app world is confusing and terrible."

tl;dr

This is a quick script (and an optional scheduler) that fetches all the new activities in Suunto Movescount since the date specified in last_successful_run.txt, and inserts them into Strava. It then updates that file with today's date. The built-in Strava importer does not work for me because it requires GPS data, something my stationary workouts don't get (from Preva, Precor's "cloud").

The script makes a bunch of assumptions that work for me, but if you might want something similar, feel free to generalize it.

How To Use

Prerequisites

  1. Clone the repo locally: git clone https://github.com/ENuge/suunto2strava.git.
  2. Make a couple of files untracked, so git isn't noisy: git update-index --assume-unchanged .secret/api_keys.rb last_successful_run.rb.
  3. Edit .secret/api_keys.rb with your keys. See the Finding My Keys section.

As a one-off mass import of all Suunto Movescount data:

  1. Change last_successful_run.txt to an arbitrary date in the past, say: 1990-02-04.
  2. Run: ruby suunto2strava.rb. (I used Ruby 2.5.1, I don't know which versions it works with. The script requires a handful of gems.)

As a daily import of all new Suunto Movescount data:
NOTE: If you know launchd better than I do, please fix up the steaming garbage I have here.

  1. Update daily_scheduler.plist to use the location of your daily_scheduler.sh.
  2. Update daily_scheduler.sh to point to the location of your Ruby executable and where you have suunto2strava.rb located.
  3. Copy daily_scheduler.plist into /Library/LaunchAgents/, for me this was: sudo cp ~/Documents/suunto2strava/daily_scheduler.plist /Library/LaunchAgents/.
  4. Run: cd /Library/LaunchAgents/ && sudo launchctl load -w daily_scheduler.plist && sudo launchctl start com.suunto2strava.importSuuntoToStrava.
  5. Check the log files specified in daily_scheduler.plist, make sure they have some output. If not, open an issue or something.

Finding My Keys

I'm feeling lazy, so just bear with me:

Strava API Key

  1. Create a Strava app: https://www.strava.com/settings/api . Say you're an importer or something.
  2. Follow the steps in here, use the access token you get: https://yizeng.me/2017/01/11/get-a-strava-api-access-token-with-write-permission/.

Movescount Cookie

  1. Login to MovesCount.
  2. Open the Chrome Inspector, click Application, then copy the Value of MovesCountCookie. That should keep you authenticated for a year.

The Intent

I cycle, both indoors and outdoors. Outdoors, I track my commute and weekend rides with Strava. Indoors, my gym has Precor machines which connect to Preva, which is like a really annoying Strava for Precor.

I want to get that data into Strava.

At first, it looked easy. I can connect Preva to Suunto, some sort of Garmin-like watch company that can then auto-import data into Strava. Hooray! ...Except, Strava flat-out rejects imported files with no gps data (this is also true if I manually export my Suunto data and then import to Strava). This is despite Strava's API not even letting me input GPS data of my own (!).

So let's fix all this with code, and get these stupid bike rides into Strava.

The How

I wanted to not scrape Suunto if possible, so I inspected the network requests and found the direct ajax endpoint called. The cookie works for a year, which is nice. The script fetches that, gets the most recent activities, and POSTs em to Strava.

suunto2strava's People

Contributors

enuge avatar

Watchers

James Cloos avatar

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.