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 258.2k 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.
    • H Offline
      hattlegr @ianperrin
      last edited by

      @ianperrin I went right back to the beginning and started the installation again to ensure I save each step.
      During the process I picked up on an error I did not follow up on. After installing --production I had to run ‘npm audit fix’

      After running this I tried the authentication again. This time the process did add the token.js file to the MMM=Strava module.

      I believe it is working now. I have logged off and rebooted to confirm and the Strava module was working correctly.

      
      pi@raspberrypi:~/MagicMirror/modules/MMM-Strava $ git checkout develop && git pull
      Branch develop set up to track remote branch develop from origin.
      Switched to a new branch 'develop'
      Already up-to-date.
      pi@raspberrypi:~/MagicMirror/modules/MMM-Strava $ npm install --production
      npm WARN conflict A git conflict was detected in package-lock.json. Attempting to auto-resolve.
      npm WARN conflict To make this happen automatically on git rebase/merge, consider using the npm-merge-driver:
      npm WARN conflict $ npx npm-merge-driver install -g
      npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
      added 55 packages from 67 contributors and audited 3075 packages in 32.396s
      found 1 moderate severity vulnerability
        run `npm audit fix` to fix them, or `npm audit` for details // Was important to run this command to make authentication process work correctly
      
      
      pi@raspberrypi:~/MagicMirror/modules/MMM-Strava $ npm audit fix
      npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
      added 537 packages from 583 contributors in 92.726s
      fixed 1 of 1 vulnerability in 3075 scanned packages
      pi@raspberrypi:~/MagicMirror/modules/MMM-Strava $ npm audit
                                                                                      
                             === npm audit security report ===                        
                                                                                      
      found 0 vulnerabilities
       in 3075 scanned packages
      pi@raspberrypi:~/MagicMirror/modules/MMM-Strava $
      
      // Config 
      {
      			module: "MMM-Strava",
      			position:  "center",
      			config: {
      				client_id: "3---6",
      				client_secret: "f22b--------------------0d9f7",
      				mode: "chart",
      				auto_rotate: "true",
      				units: "imperial"
      			}
      
      1 Reply Last reply Reply Quote 0
      • lavolp3L Offline
        lavolp3 Module Developer @ianperrin
        last edited by

        @ianperrin said in MMM-Strava:

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

        Just wanted to report that the module is working fine until now using the development branch.

        What I would like to implement is some kind of a record panel showing the fastest 1k, 5k, 10k for running 20k, 40k, for cycling etc.
        I can’t see this in the API. Does anyone know a way to extract these values?

        How to troubleshoot modules
        MMM-soccer v2, MMM-AVStock

        1 Reply Last reply Reply Quote 0
        • L Offline
          Lorenz
          last edited by Lorenz

          When i use the new development branch the api for profile switcher isn’t working anymore. (the notification from MMM-Remote to be exact)

          1 Reply Last reply Reply Quote 0
          • lavolp3L Offline
            lavolp3 Module Developer
            last edited by lavolp3

            Hi all, Hi @ianperrin

            I love hunting for segments and for that I would like to include some kind of “crown board” calculating golden, silver and bronze crowns for first, second and third places in segments.
            At a later stage I can imagine including more information, e.g. some kind of notification if you lose a first pace to someone else.
            However, it’s not easy to get these numbers via the API.

            So, to summarise: I need the count of podium places for segments in running and cycling. These can change over time! So need to be checked and counted regularly.

            For these I need all segments the athlete has competed in.

            My approach would be:
            Go through ALL activities, pick segment ID’s, combine these and search through each segment leaderboard for the athlete’s name.
            However, this would be a LOT of API calls. And these are limited to 600 in 15 min. With a few hundred activities these can be exceed easily.
            So the call would somehow need to be stretched and used not with every other call.

            Any other ideas or input for this idea?

            Thanks for every input, as always!

            How to troubleshoot modules
            MMM-soccer v2, MMM-AVStock

            1 Reply Last reply Reply Quote 0
            • lavolp3L Offline
              lavolp3 Module Developer
              last edited by

              Hi all, hi @ianperrin ,it’s me again.

              I’m coding a lot with this module trying to build a bigger version of it, and stumbled upon some odd thing. I have included some console logs and found that for some reason the socket notification “SET_CONFIG” is received twice when the module starts, leading to two api calls directly after another. I can only see one send in the browser console from MMM-Strava.js, but two notification receives in the npm logs. Can someone duplicate our even explain this odd behavior?
              Thanks!

              How to troubleshoot modules
              MMM-soccer v2, MMM-AVStock

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

                Don’t forget that Strava is switching to using refresh tokens from 15th October 2019 and won’t be supporting forever tokens anymore. I started writing a little Strava api library in js, currently with only 2 endpoints and going to add up more ofc.

                https://github.com/dnovacik/strava-minimal-api

                lavolp3L 1 Reply Last reply Reply Quote 0
                • lavolp3L Offline
                  lavolp3 Module Developer @dnovacik
                  last edited by lavolp3

                  @dnovacik Well this module uses the strava-v3 nodejs library by unboundev.
                  github link.
                  I guess that is where the new token procedure should be implemented isn’t it?
                  Care to take a look?

                  How to troubleshoot modules
                  MMM-soccer v2, MMM-AVStock

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

                    @dnovacik

                    The develop branch for the module contains the changes to support the new authentication approach - I’ll merge that back into the master branch in the coming weeks so the module can continue to be used

                    @lavolp3

                    I extended the Strava-v3 package (see https://github.com/ianperrin/MMM-Strava/blob/develop/strava_api.js) to support the new authentication methods. I guess these could be incorporated into a pull request for the core package now that it is active again ;)

                    "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
                    • D Offline
                      dnovacik
                      last edited by

                      @ianperrin gj then, can’t wait to try out the module!

                      1 Reply Last reply Reply Quote 0
                      • Z Offline
                        zolabus
                        last edited by

                        I can’t use the module anymore
                        If I try to reauthorize i have this error

                        {“message”:“Bad Request”,“errors”:[{“resource”:“Authorize”,“field”:“scope”,“code”:“invalid”}]}

                        Any help please?
                        Thanks

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

                          @zolabus said in MMM-Strava:

                          I can’t use the module anymore
                          If I try to reauthorize i have this error

                          {“message”:“Bad Request”,“errors”:[{“resource”:“Authorize”,“field”:“scope”,“code”:“invalid”}]}

                          Any help please?
                          Thanks

                          @zolabus - I’ve just released version 2.0.0 of the plugin which is available via the Master branch. Can you try this version?

                          When updating please make sure you run npm install --production from the MMM-Strava directory.

                          If you continue to get these errors, please check the Authorization Callback Domain in your Strava API Settings (https://www.strava.com/settings/api) matches the IP address/URL used to access MagicMirror

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

                          Z 1 Reply Last reply Reply Quote 0
                          • Z Offline
                            zolabus @ianperrin
                            last edited by

                            @ianperrin
                            Hi I updated the module
                            When I restart the Magic Mirror I receive this
                            MMM-Strava: “Received notification: SET_CONFIG”
                            MMM-Strava: “Legacy config in use for module_14_MMM-Strava”
                            MMM-Strava: “Getting data for module_14_MMM-Strava”
                            MMM-Strava: “Access token not found for module_14_MMM-Strava”

                            Z 1 Reply Last reply Reply Quote 0
                            • Z Offline
                              zolabus @zolabus
                              last edited by

                              @ianperrin
                              Issue resolved thanks

                              1 Reply Last reply Reply Quote 1
                              • M Offline
                                MisterT
                                last edited by

                                Hi everybody,
                                I posted in troubleshooting section but i don’t know if it’s visible. That’s why i post here. I don’t understand the step 2 and the step 5 in Tutorial about MMM-Strava. I have a ID and a secret but i don’t know what i write in case:

                                APi Name
                                Category
                                Club
                                WebSite
                                Description
                                and Callback domain

                                In Website and Callback domain what i write?
                                In callback domain, i put my IP to my magic mirror like 192.128.1.99:8080 but nothing happen

                                Can anybody help me please?

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

                                  @MisterT

                                  When creating your Strava API Application in Step 2, the key value is the Authorisation Callback Domain. This needs to the IP address or domain name you use to access the MagicMirror otherwise subsequent steps will fail. So in your case it looks like you should use 192.128.1.99

                                  Once the API Application is created, add the module to your config.js file with the client_id and client_secret then restart the mirror.

                                  The module should then state Client id unauthorised and provide a link to the authorisation process. At which point you should be able to follow step 5

                                  Here’s two screenshots which might help:
                                  Strava API Settings

                                  Strava API id and secret

                                  "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
                                  • M Offline
                                    MisterT
                                    last edited by

                                    ok thanks ianperrin for your help
                                    Step 2 is ok because on magic mirror, i have the link on magic mirror : client unauthorized see /MMM-Strava/auth/

                                    but now in step 5, i make:
                                    in webpage, and magic mirror starting i put
                                    http://192.128.1.99:8080/MMM-Strava/Oauth/
                                    but nothing happen. The webpage says:
                                    host unreachable
                                    ERR_CONNECTION_REFUSED

                                    have you an idea?

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

                                      @MisterT is it possible you’re typing in the wrong url. Try using
                                      http://192.128.1.99:8080/MMM-Strava/auth/ or simply clicking the link displayed by the module on the mirror.

                                      If that fails, are you able to access your mirror via http://192.128.1.99:8080/ ?

                                      Finally, can you make sure you ran npm install --production in step 1 and restarted the mirror?

                                      "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
                                      • M Offline
                                        MisterT
                                        last edited by MisterT

                                        hI @ianperrin
                                        It Works !!!
                                        Nice explanations.
                                        My mistake is when i launched a webpage to write the url i stoped the MM by Ctrl+Q. Now with MM start and a webpage opened. Everything is alright

                                        Thanks for your help

                                        1 Reply Last reply Reply Quote 1
                                        • M Offline
                                          MisterT
                                          last edited by

                                          hI @ianperrin
                                          I have another problem with MMM-Strava.
                                          I use it with MMM-Pages and MMM-Pages indicator. When i place the module in the config.js MMM-Pages settings, the Rotation of MMM-Pages doesn’t work and i have a error on Magic mirror when i press CTRL+SHIFT+i.
                                          See Thread below for mox explanations

                                          MMM-Pages no rotate

                                          Have you an idea?

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

                                            @MisterT thanks for the report.

                                            I don’t have any experience with MMM-Pages so will have to install it and take a look if I experience the same issues.

                                            Have you any idea what might be causing it?

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

                                            M 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