A MagicMirror Module for displaying your Strava data.
table
mode, which displays- The number of activities for the period.
- The total distance for the period.
- The total elevation gain for the period. (optional)
- The total moving time for the period. (optional)
- The total elapsed time for the period. (optional)
- The total number of achievements (
recent
period only).
chart
mode, which displays- The total distance, moving time and elevation for the period.
- A chart showing the total distance by day (for
recent
period) or month (forytd
period).
- Which
activities
(and the order activities) should be displayed. - Which
stats
should be displayed intable
mode. - 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 (only applicable in
table
mode).
- "recent" - last 4 weeks in
- Which
chartType
should be used inchart
mode: - Whether the module should rotate through the different periods, and the interval between rotations. (only applicable in
table
mode) - The units (miles/feet or kilometres/metres) used to display the total distance and elevation gain for each activity.
- The locale used for determining the date (day or month) labels in the chart.
-
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. | "ride" , "run" , "swim" |
period |
recent |
Optional - What period should be used to summarise the activities in table and chart mode. |
recent = recent (last 4 weeks), ytd = year to date, all = all time |
stats |
["count", "distance", "achievements"] |
Optional - Determines which statistics to display in table mode. 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 | Possible values: 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). | Possible values: 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 |