MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-Strava

    Scheduled Pinned Locked Moved Health
    activity trackerhealthstrava
    138 Posts 34 Posters 257.5k Views 35 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G Offline
      GMD @ianperrin
      last edited by

      @ianperrin

      Hi Ian

      Can you help as I think I am getting confused.

      I carried out the following steps:

      1. Imported MMM-Strava into my modules folder.
      2. Logged into my Strava account and navigated ->Settings->My API Application
      3. Created an application icon
      4. Completed fields, Application Name = MyData, Category = Other, Website = https://Strava.com, Authorization Callback Domain = 127.0.0.1
      5. Click update button
      6. Copied Client ID and Your Access Token (?) (permissions: public)
      7. Update MagicMirror config.js with Client ID and Your Access Token
      8. Restarted MagicMirror

      When MagicMirror displays the Strava modules says Loading… and looking at the terminal window I can see errors:

      Error performing request: Unauthorized. Access Token will be reset.
      Error while fetching new athlete stats.

      Which looks to be a 401 error from code that, access token has not been authorised.

      Can anybody point me to what I am doing wrong.

      1 Reply Last reply Reply Quote 0
      • karsten13K Online
        karsten13
        last edited by

        Hi,

        sounds you took the client id from the strava api page as input for strava_id of the module?

        Input of strava_id: https://support.strava.com/hc/en-us/articles/216928797-Where-do-i-find-my-Strava-ID-

        Karsten.

        G 1 Reply Last reply Reply Quote 0
        • G Offline
          GMD @karsten13
          last edited by

          @karsten13

          Hi

          Firstly thank you for your reply.

          You are correct I used the client id and when I replaced this with the strava id as your link described all works great.

          Thanks again.

          1 Reply Last reply Reply Quote 0
          • D Offline
            Dicous
            last edited by

            Hello,
            I have the problems that with the following config the module is always “loading…”.

            Can someone help me?

            		{
            			module: 'MMM-Strava',
            			position: 'top_left',
            			config: {
            				strava_id: 'xxx1, xxx2',
            				access_token: 'xxx1, xxx2',
            				activities: 'run',
            				athlete_text: 'Tine, Basti',
            			    auto_rotate: 'true'
            				 }
            		},
            
            karsten13K 1 Reply Last reply Reply Quote 0
            • karsten13K Online
              karsten13 @Dicous
              last edited by

              try it with the missing brackets:

              		{
              			module: 'MMM-Strava',
              			position: 'top_left',
              			config: {
              				strava_id: ['xxx1', 'xxx2'],
              				access_token: ['xxx1', 'xxx2'],
              				activities: ['run'],
              				athlete_text: ['Tine', 'Basti'],
              			    auto_rotate: 'true'
              				 }
              		},
              
              1 Reply Last reply Reply Quote 0
              • D Offline
                Dicous
                last edited by

                Unfortunately, no solution

                1 Reply Last reply Reply Quote 0
                • karsten13K Online
                  karsten13
                  last edited by

                  your setup works for me, changed only strava_id’s and access_token’s.
                  Did you put every single strava_id and every single access_token in single quotes as provided in my example? In your post you put 2 things in one single quote …
                  Other possibilities: Wrong strava data (id/token)? Did you read the documentation how to get strava_id?
                  Did you take a look in the logs?
                  If I test it with your testdata xxx I find these lines in the logs:

                  Error performing request: Unauthorized. Access Token will be reset.
                  Error while fetching new athlete stats.
                  
                  
                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    Dicous
                    last edited by

                    It works. Despite control I had the wrong API sorry

                    1 Reply Last reply Reply Quote 0
                    • zerodegree79Z Offline
                      zerodegree79
                      last edited by

                      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”

                      I 1 Reply Last reply Reply Quote 0
                      • I Offline
                        ianperrin @zerodegree79
                        last edited by ianperrin

                        @zerodegree79

                        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

                        "Live as if you were to die tomorrow. Learn as if you were to live forever." - Mahatma Gandhi

                        zerodegree79Z 1 Reply Last reply Reply Quote 0
                        • zerodegree79Z Offline
                          zerodegree79 @ianperrin
                          last edited by

                          @ianperrin said in MMM-Strava:

                          @zerodegree79

                          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.

                          I 1 Reply Last reply Reply Quote 0
                          • I Offline
                            ianperrin @zerodegree79
                            last edited by

                            @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 virtual activities in the chart stats. Take a look and let me know if this works as expected.

                            "Live as if you were to die tomorrow. Learn as if you were to live forever." - Mahatma Gandhi

                            zerodegree79Z 1 Reply Last reply Reply Quote 0
                            • zerodegree79Z Offline
                              zerodegree79 @ianperrin
                              last edited by

                              @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.

                              I 1 Reply Last reply Reply Quote 0
                              • I Offline
                                ianperrin @zerodegree79
                                last edited by ianperrin

                                @zerodegree79

                                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, pull the latest version of the module and make sure config.js is correctly configured.

                                There is no need to add anything special to the config to include virtual activities as these will be rolled up into the ride and run totals in the chart like the table mode and your dashboard on the Strava website

                                "Live as if you were to die tomorrow. Learn as if you were to live forever." - Mahatma Gandhi

                                zerodegree79Z 1 Reply Last reply Reply Quote 0
                                • zerodegree79Z Offline
                                  zerodegree79 @ianperrin
                                  last edited by

                                  @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?

                                  1 Reply Last reply Reply Quote 0
                                  • zerodegree79Z Offline
                                    zerodegree79
                                    last edited by

                                    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.

                                    C 1 Reply Last reply Reply Quote 0
                                    • C Offline
                                      ctatos @zerodegree79
                                      last edited by

                                      @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…

                                      I zerodegree79Z 2 Replies Last reply Reply Quote 0
                                      • I Offline
                                        ianperrin @ctatos
                                        last edited by

                                        @ctatos could you send me a pm with details of the script and cron setup you are using?

                                        "Live as if you were to die tomorrow. Learn as if you were to live forever." - Mahatma Gandhi

                                        1 Reply Last reply Reply Quote 0
                                        • zerodegree79Z Offline
                                          zerodegree79 @ctatos
                                          last edited by

                                          @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.

                                          V 1 Reply Last reply Reply Quote 0
                                          • V Offline
                                            Val07300 @zerodegree79
                                            last edited by

                                            @zerodegree79 Any news about New Strava API integration ?

                                            zerodegree79Z 1 Reply Last reply Reply Quote 0

                                            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
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 7
                                            • 4 / 7
                                            • First post
                                              Last post
                                            Enjoying MagicMirror? Please consider a donation!
                                            MagicMirror created by Michael Teeuw.
                                            Forum managed by Sam, technical setup by Karsten.
                                            This forum is using NodeBB as its core | Contributors
                                            Contact | Privacy Policy