Read the statement by Michael Teeuw here.
MMM-Strava
-
It works. Despite control I had the wrong API sorry
-
Hi guys, i am using the Strava-Module and over the Winter i am doing a lot of indoor-cycling with Zwift. I was wondering if it is possible to integrate “virtual cycling” into the module and if it’s possible, then how. Hope anyone can answer this. I don`t need the “swim” anyway, so i would like to interchange it with “virtual ride”
-
You should be able to hide swim activities by adding the following to your config
activities: ["ride", "run"]Adding other activity types will need some investigation of the Strava API as ActivityStats only returns totals for the three activity types currently available.
I need to look at the module again shortly as there is an change to the API which requires a different authentication mechanism so I’ll try an pick this up then
-
@ianperrin said in MMM-Strava:
You should be able to hide swim activities by adding ‘’‘activities: [“ride”, “run”]’‘’ to your config
Adding other activity types will need some investigation of the Strava API as ActivityStats only returns totals for the three activity types currently available.
I need to look at the module again shortly as there is an change to the API which requires a different authentication mechanism so I’ll try an pick this up then
Thanks for your reply. I know that i can hide “swim”, but just wanted to change it to “virtual ride”. So i just wait until you have looked at the API.
Thanks in advance for your support. -
@zerodegree79 great - wasn’t sure from your comment whether you’d spotted the option on the config.
After a quick look, I’ve pushed a change to the module which includes
virtualactivities in the chart stats. Take a look and let me know if this works as expected. -
@ianperrin hi, thanks for the fast response. I tried to update, but now it is stuck in loading activities. I changed the MMM-Strava.js. What else do i need to edit? Below is my config:
// Default module config. defaults: { strava_id: ['XXXXXX'], // List of strava_id's, could get this from current athlete - https://strava.github.io/api/v3/athlete/#get-details access_token: ['XXXXXXXXXXXXXXXXX'], // List of acces_token's (corresponding to the strava_id's), see https://www.strava.com/settings/api athlete_text: [''], // List of athlete_text's (corresponding to the strava_id's), will be diplayed instead of ativity_text mode: 'table', // Possible values "table", "chart" elevation: true, // Shows elevation in "table" mode activities: ["ride", "run", "virtual"], // Possible values "ride", "run", "swim" period: "all", // Possible values "recent", "ytd", "all" auto_rotate: true, // Rotate stats through each period starting from specified period locale: config.language, units: config.units, fade: false, fadePoint: 0.1, // Start on 1/4th of the list. reloadInterval: 5 * 60 * 1000, // every 5 minutes updateInterval: 600 * 1000, // 10 seconds animationSpeed: 10 * 1000, // 2.5 seconds debug: false, // Set to true to enable extending logging },No idea whats wrong. Thanks in advance.
-
You should avoid editing the module files and place your configuration in the config.js file - check the readme file for installation, update and configuration notes
Once you’ve reverted your changes to the module files,
pullthe latest version of the module and make sureconfig.jsis correctly configured.There is no need to add anything special to the config to include
virtualactivities as these will be rolled up into therideandruntotals in the chart like the table mode and your dashboard on the Strava website -
@ianperrin thanks for your help, changed back and now it`s working fine. Just one Question left. Is there a way to “isolate” the virtual rides? To show them separately in the charts?
-
HEy @ianperrin, since Strava changed their API- Refreshing, i need to put in the Access Token manually every 6 hours. Can you change this in your module? Here is the API Handbook from Strava. I have no idea how this wors, so maybe you can fix it. https://developers.strava.com/docs/authentication/#Refresh expired
Thanks in advance.
-
@zerodegree79 I temporarily solved the problem with an external python script found at https://github.com/hozn/stravalib . The script retrieves a newly generated access token every 4-5h and find/replaces it in the config.js file. I then have a crontab that recycles the Magic Mirror.
There must be a better way, but I can’t complain for now…
-
@ctatos could you send me a pm with details of the script and cron setup you are using?
-
@ctatos said in MMM-Strava:
@zerodegree79 I temporarily solved the problem with an external python script found at https://github.com/hozn/stravalib . The script retrieves a newly generated access token every 4-5h and find/replaces it in the config.js file. I then have a crontab that recycles the Magic Mirror.
There must be a better way, but I can’t complain for now…
That’s way over my head, but great effort. Maybe @ianperrin can implement this.
-
@zerodegree79 Any news about New Strava API integration ?
-
@val07300 no, waiting for @ianperrin and @ctatos giving a response
-
Not as yet I’m afraid.
Hoping to work on it in the coming weeks - work and other commitments permitting.
PRs welcome from those who might have the know how 😉
-
@ianperrin said in MMM-Strava:
No as yet I’m afraid.
Hoping to work on it in the coming weeks - work and other commitments permitting.
PRs welcome from those who might have the know how 😉
No worries, take your time. Meanwhile i just update manually
-
@zerodegree79 , @Val07300, @ctatos (and others I may have missed).
A new (beta) version of the module with support for Strava’s new authentication flow is available.
Much of the code for the module has been re-written/re-factored and includes a number of changes to the original module including
- Support for multiple instances of the module
- The table and chart and now generated via templates (rather than javascript)
- A helper is included to simplify the initial authentication with Strava
chartmode now supports either therecentandytdvalues in theperiodoption- The stats displayed in
tablemode are configurable via thestatsoption - To support the new authentication flow, the
client_idandclient_secretmust be included in the config in place of the deprecatedstrava_idandaccess_tokenoptions. The legacy options can still be used, but will trigger an alert on the mirror when the module is loaded and it is recommended they are removed.
Please note - the module no longer supports multiple athlete id’s in one module instance. Multiple instances can be added to the config file to achieve similar results.
Notes for beta testers
This functionality is only available in the develop branch of the github repository at this time. Once any issues have been fixed, the master branch will be updated.
To test the refresh token functionality and the new authentication flow in the Magic Mirror, you need to update the module using the following steps:
- stop the Magic Mirror
- switch to the develop branch and install the new dependencies
cd ~/MagicMirror/modules/MMM-Strava git checkout develop && git pull npm install --production - edit the MMM-Strava configuration in config.js and
- remove
strava_idandaccess_tokenoptions - add
client_idandclient_secretoptions. The values for these options should be copied from the My API Application page in your Strava profile
- remove
- restart the Magic Mirror
When updated correctly, the module should display a Client id unauthorised message. The module can be authorised using the following steps:
- Browse to http://localhost:8080/MMM-Strava/auth/ on the Magic Mirror. This can be done remotely if you have setup the
ipWhitelistin the Magic Mirror - Select module and click Authorise
- If prompted, log in to Strava
- On the Strava Authorisation page, click Authorize
- Once the successful authorisation message appears, restart your Magic Mirror.
-
@ianperrin
From the new authorization process I’m getting a bad request from Strava:{ "message": "Bad Request", "errors": [ { "resource": "Application", "field": "redirect_uri", "code": "invalid" } ] }I have the feeling that I have an error in my Strava API config.
There is a “website” and a “Callback domain” that I need to put in. Does this have to do anything with the address I’m using for the authentication process via /MMM-Strava/auth?EDIT: Can it be because I’m currently accessing the mirror through a ddns service, so the address is not localhost:8080 but something else?
-
@lavolp3 are you browsing to http://localhost:8080/MMM-Strava/auth/ and using the authorisation process there? If so, where is the bad request being displayed?
It should look something like this:

-
@ianperrin No I’m browsing from a laptop like always. So it’s http://magicmirror:8080/MMM-Strava/auth/.
Do you think that makes a difference?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login