A MagicMirror Module for displaying your Strava data.
table
mode, which displays a table showing the number of activities, the total distance and (for recentperiod
only) the number of achievements.chart
mode, which displays the total distance, moving time and elevation gain alongside a chart showing the total distance grouped by- day (for
recent
period), - month (for
ytd
period), - year (for
all
period).
- day (for
- Which
activities
(and the order activities) should be displayed. - Which
stats
should be displayed.- The number of activities (
count
). - The total distance (
distance
). - The total elevation gain (
elevation
). - The total moving time for the period. (
moving_time
). - The total elapsed time for the period. (
elapsed_time
). - The total number of achievements (
achievements
) - intable
mode, only available forrecent
period).
- The number of activities (
- Which
period
to display stats for your activities:- "recent" - last 4 weeks in
table
mode or current week inchart
mode. - "ytd" - current year to date.
- "all" - all time.
- "recent" - last 4 weeks in
- Which
chartType
should be used inchart
mode: - The
firstYear
to group activities by inchart
mode when theperiod
is "all". - Whether the module should
auto_rotate
through the different periods, and theupdateInterval
between rotations. (only applicable intable
mode). - The
units
(miles/feet or kilometres/metres) used to display the total distance and elevation gain statistics. - The
locale
used for determining the date (day or month) labels inchart
mode and number format in both modes. - The number of decimal
digits
displayed for the total distance and elevation gain statistics.
-
Stop your MagicMirror and clone the repository into the modules folder
cd ~/MagicMirror/modules git clone https://github.com/ianperrin/MMM-Strava.git cd ~/MagicMirror/modules/MMM-Strava npm install --production
-
Create a Strava API Application and note the
client_id
andclient_secret
- Browse to your My API Application page and log in to Strava if prompted.
- Make sure the callback domain matches the IP address (or URL) used to access the MagicMirror.
- Make a note of the
client_id
andclient_secret
-
Add the module to the config file (
~/MagicMirror/config/config.js
) for your mirror.modules: [ { module: "MMM-Strava", position: "top_right", config: { client_id: "your_strava_client_id", client_secret: "your_strava_api_client_secret" } } ];
The full list of config options can be found in the configuration options table.
-
Restart the MagicMirror
pm2 restart mm
-
Authenticate the module to allow access to the Strava API.
- Browse to the Strava authentication page: http://localhost:8080/MMM-Strava/auth/ - the exact URL may vary depending on your configuration.
- Select the module you wish to authenticate (e.g.
module_4_MMM-Strava
) and click/tap Authorise -The number of the modules will vary depending on your configuration. - On the Strava Authorisation page, select the level of access you wish to give to the Magic Mirror, and click/tap Authorize - the module requires at least
View data about your public profile
andView data about your activities
but it's up to you whether you want to allow access toprivate activities
. - Once the successful authorisation message appears, restart your Magic Mirror.
To update the module to the latest version,
-
Pull the changes from this repository into the MMM-Strava folder:
cd ~/MagicMirror/modules/MMM-Strava git pull npm install --production
-
Update your config file to remove the
strava_id
andaccess_token
options and add the newclient_id
andclient_secret
options - See steps 2 and 4 in the installation notes.
Please Note Following the changes to Strava’s authentication model, the client_id and client_secret must be included in the config in place of the deprecated strava_id and access_token options.
If you haven't changed the module, this should work without any problems. If you have a problem, you can reset the module using git reset --hard
, after which git pull
should be possible. You may wish to use git status
to see any changes before doing so.
The following properties can be added to the configuration:
Option | Default | Description | Possible Values |
---|---|---|---|
client_id |
Required - The Client ID for your Strava API Application, obtained from your My API Application page. | ||
client_secret |
Required - The Client Secret for your Strava API Application, obtained from your My API Application page. | ||
mode |
table |
Optional - Determines which mode should be used to display activity information. | "table" , "chart" |
chartType |
bar |
Optional - Determines the type of chert which should be displayed in chart . |
"bar" , "radial" |
activities |
["ride", "run", "swim"] |
Optional - Determines which activities to display and in which order they are displayed. Note: - The activities can be listed in any order, and only one is required. However, they must be entered as an array of strings i.e. comma separated values within square brackets. | In table mode: "ride" , "run" , "swim" In chart mode: "alpineski" , "backcountryski" , "canoeing" , "crossfit" , "ebikeride" , "elliptical" , "golf" , "handcycle" , "hike" , "iceskate" , "inlineskate" , "kayaking" , "kitesurf" , "nordicski" , "ride" , "rockclimbing" , "rollerski" , "rowing" , "run" , "sail" , "skateboard" , "snowboard" , "snowshoe" , "soccer" , "stairstepper" , "standuppaddling" , "surfing" , "swim" , "velomobile" , "virtualride" , "virtualrun" , "walk" , "weighttraining" , "wheelchair" , "windsurf" , "workout" , "yoga" |
period |
recent |
Optional - What period should be used to summarise the activities in table and chart mode. |
recent = last 4 weeks in table mode or current week in chart mode, ytd = year to date, all = all time |
stats |
In table mode: ["count", "distance", "achievements"] In chart mode: ["distance", "moving_time", "elevation"] |
Optional - Determines which statistics to display. Note: - The stats can be listed in any order, and only one is required. However, they must be entered as an array of strings i.e. comma separated values within square brackets. |
"count" , "distance" , "elevation" , "moving_time" , "elapsed_time" , "achievements" |
auto_rotate |
false |
Optional - Whether the summary of activities should rotate through the different periods in table mode. |
true = rotates the summary through the different periods, false = displays the specified period only. |
units |
config.units |
Optional - What units to use. Specified by config.js | config.units = Specified by config.js, metric = Kilometres/Metres, imperial = Miles/Feet |
updateInterval |
10000 (10 seconds) |
Optional - How often does the period have to change? (Milliseconds). | 1000 - 86400000 |
reloadInterval |
300000 (5 minutes) |
Optional - How often does the data needs to be reloaded from the API? (Milliseconds). See Strava documentation for API rate limits | 7500 - 86400000 |
animationSpeed |
2500 |
Optional - The speed of the update animation. (Milliseconds) | 0 - 5000 |
locale |
config.language |
Optional - The locale to be used for displaying dates - e.g. the days of the week or months or the year in chart mode. If omitted, the config.language will be used. | e.g. en , en-gb , fr etc |
debug |
false |
Optional - Outputs extended logging to the console/log | true = enables extended logging, false = disables extended logging |
digits |
1 |
Optional - Digits for total distance and elevation gain statistics | 0 - ... |
firstYear |
Five years before the current date. | Optional - The first year activities should be grouped by in chart mode when the period is "all". |
0 - ... |