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-DynamicWeather Failed getting api: 401

    Scheduled Pinned Locked Moved Solved Troubleshooting
    21 Posts 4 Posters 2.1k Views 4 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.
    • S Offline
      sdetweil @JohnGalt
      last edited by

      @JohnGalt you NEED to install the pull request to get the updated module code using the 3.0 api…

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        JohnGalt @sdetweil
        last edited by

        @sdetweil Yes, I realize that… I guess I skipped some thoughts that were rolling around in my head but never made it to the keyboard: I had disabled the module, figuring I would just wait for it to be updated.

        I should have some time this evening to go in and install the pull request - I will let you know what happens.

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @JohnGalt
          last edited by

          @JohnGalt yes, but its unlikely to be updated by the author, but you have the pull request as a substitute/the update

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            JohnGalt @sdetweil
            last edited by

            @sdetweil – OK, so I did install the pull request, and it’s not working. After following the steps above, I still get errors:

            Actions taken:
               - git fetch origin pull/52/head:with_30_apikey
               - realized I misread the instructions, so went back, and did the reset...
               -  git reset --hard HEAD 
                - git fetch origin pull/52/head:with_30_apikey
                - enable module in config.js
               - pm2 restart MM ]
            
            Results as shown in pm2 logs, which was running at the time:
            Immediate Results:
            0|MagicMirror  | [2024-11-11 17:02:25.687] [ERROR] [MMM-DynamicWeather] Failed getting api:  AggregateError [ETIMEDOUT]:
            0|MagicMirror  |     at internalConnectMultiple (node:net:1117:18)
            0|MagicMirror  |     at internalConnectMultiple (node:net:1185:5)
            0|MagicMirror  |     at Timeout.internalConnectMultipleTimeout (node:net:1711:5)
            0|MagicMirror  |     at listOnTimeout (node:internal/timers:575:11)
            0|MagicMirror  |     at process.processTimers (node:internal/timers:514:7) {
            0|MagicMirror  |   code: 'ETIMEDOUT',
            0|MagicMirror  |   [errors]: [
            0|MagicMirror  |     Error: connect ETIMEDOUT 38.89.70.82:443
            0|MagicMirror  |         at createConnectionError (node:net:1647:14)
            0|MagicMirror  |         at Timeout.internalConnectMultipleTimeout (node:net:1706:38)
            0|MagicMirror  |         at listOnTimeout (node:internal/timers:575:11)
            0|MagicMirror  |         at process.processTimers (node:internal/timers:514:7) {
            0|MagicMirror  |       errno: -110,
            0|MagicMirror  |       code: 'ETIMEDOUT',
            0|MagicMirror  |       syscall: 'connect',
            0|MagicMirror  |       address: '38.89.70.82',
            0|MagicMirror  |       port: 443
            0|MagicMirror  |     },
            0|MagicMirror  |     Error: connect ENETUNREACH 2604:86c0:5001:b::2:443 - Local (:::0)
            0|MagicMirror  |         at internalConnectMultiple (node:net:1181:16)
            0|MagicMirror  |         at Timeout.internalConnectMultipleTimeout (node:net:1711:5)
            0|MagicMirror  |         at listOnTimeout (node:internal/timers:575:11)
            0|MagicMirror  |         at process.processTimers (node:internal/timers:514:7) {
            0|MagicMirror  |       errno: -101,
            0|MagicMirror  |       code: 'ENETUNREACH',
            0|MagicMirror  |       syscall: 'connect',
            0|MagicMirror  |       address: '2604:86c0:5001:b::2',
            0|MagicMirror  |       port: 443
            0|MagicMirror  |     }
            0|MagicMirror  |   ]
            0|MagicMirror  | }
            0|MagicMirror  | [2024-11-11 17:02:25.701] [LOG]   [MMM-OpenWeatherMapForecast] 11-Nov-24 17:02 ** ERROR ** fetch failed
            
            Periodic Fetch results:
            
            0|MagicMirror  | [2024-11-11 17:12:23.363] [ERROR] [MMM-DynamicWeather] Failed getting api:  401
            0|MagicMirror  | [2024-11-11 17:12:29.902] [INFO]  Newsfeed-Fetcher: Broadcasting 30 items.
            0|MagicMirror  | [2024-11-11 17:12:30.278] [INFO]  Newsfeed-Fetcher: Broadcasting 24 items.
            0|MagicMirror  | [2024-11-11 17:12:30.611] [INFO]  Newsfeed-Fetcher: Broadcasting 25 items.
            0|MagicMirror  | [2024-11-11 17:17:29.108] [INFO]  Newsfeed-Fetcher: Broadcasting 40 items.
            0|MagicMirror  | [2024-11-11 17:22:23.126] [INFO]  [MMM-DynamicWeather] Getting Weather API data
            0|MagicMirror  | [2024-11-11 17:22:23.324] [ERROR] [MMM-DynamicWeather] Failed getting api:  401
            
            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @JohnGalt
              last edited by

              @JohnGalt said in MMM-DynamicWeather Failed getting api: 401:

              - git fetch origin pull/52/head:with_30_apikey
              - enable module in config.js
              

              oops… I forgot a step

              - git fetch origin pull/52/head:with_30_apikey
              - get checkout with_30_apikey   <==== THIS STEP
              - enable module in config.js
              

              I just tested on my system and it worked ok

              I REALLY dont’t like the module shipping node_modules folder, cause if this is one a different platform it will cause trouble
              so I would do (and did event tho it worked)

              cd ~/MagicMirror
              sudo rm -rf node_modules
              npm install 
              

              my test config

                {
                   module: "MMM-DynamicWeather",
                   position: "fullscreen_above",
                   config: { // See https://github.com/scottcl88/MMM-DynamicWeather for more information.
                    api_key: "my 3.0 apikey",
                    lat: "38.89511000",  // random
                    lon: "-77.03637000" // random
                   }
                },
              

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              J 1 Reply Last reply Reply Quote 0
              • J Offline
                JohnGalt @sdetweil
                last edited by

                @sdetweil --Sam, thanks!! for your patience. I do have this resolved, at least in one MM instance.

                I did go back and commit the one command I missed as advised above, but still no joy. But then, …

                Strangely enough while I WAS using a valid ver 3 API key, you were right in saying my issue was an invalid API key in the call… After doing the above I was still getting a 401 error, so I accepted that the computers were doing exactly what I was telling them to do [as opposed to what I WANTED them to do]. I discovered the root cause after copying in the API key again and comparing. What I found was this:

                 apiKey: "123456789"
                

                When it should have been this:

                api_key: "123456789"
                

                I’m not sure why I started using “apiKey” instead of “api_key”, but putting it the way the module wants it fixed my issue. Thanks again!

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @JohnGalt
                  last edited by

                  @JohnGalt awesome! computers are very picky!

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • S sdetweil has marked this topic as solved on
                  • 1
                  • 2
                  • 3
                  • 3 / 3
                  • 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