WallberryTheme icon indicating copy to clipboard operation
WallberryTheme copied to clipboard

Invalid API key due to OneCall 2.5 being depreciated

Open DarkPlayerr opened this issue 1 year ago • 0 comments

Describe the bug I'm getting the "Error fetching weather: Invalid API key: Please see https://openweathermap.org/faq#error401 for more info." error.

Error Messages Are you getting any error messages? Make sure to check for errors in the javascript console.

  • If you're running MagicMirror in electron, CTR+SHIFT+I will bring up the dev tools
  • You can also start MagicMirror in dev mode automatically by running npm start dev

I am not running MagicMirror in Docker by the way. Yes, i'm getting some error codes in the dev tools. It seems like the OneCall 2.5 API has been shut down and doesn't work anymore.

// PASTE ERROR MESSAGES HERE

WB-openweathermap.js:30          GET https://api.openweathermap.org/data/2.5/onecall?lat=52.2298&lon=21.0118&appid=REDACTED&units=metric&lang=en 401 (Unauthorized)
fetchWeather @ WB-openweathermap.js:30
(anonymous) @ WB-weather.js:125
WB-provider.js:84 WB-weather: CRITICAL error fetching weather with openweathermap: Invalid API key. Please see https://openweathermap.org/faq#error401 for more info..

Please include your Magic Mirror config.js: You don't have to add the whole file, but at least add the config sections for the modules you're having trouble with. REMEMBER TO REDACT ANY API KEYS

// Paste config.js here

modules: [
      // Base WallberryTheme adds new font, styles, and a rotating background image pulled from Unsplash.com
      {
        module: "WallberryTheme",
        position: "fullscreen_below", // Required Position
        config: {
          unsplashAccessKey: "redacted", // REQUIRED
          queries: ["dark wallpaper"]
        }
      },
      {
		module: "clock",
		position: "top_left"
      },
      // WB-weather adds weather (Optional Module)
      {
        module: "WallberryTheme/WB-weather",
        position: "bottom_bar",  // Highly suggested location
        config: {
          // See "Configuration options" for more information.
          apiKey: "redacted", // REQUIRED
          latitude:   52.2298, // REQUIRED
          longitude:  21.0118 // REQUIRED
        }
      },
      {
        module: "MMM-NowPlayingOnSpotify",
        position: "top_right",
        config: {
          clientID: "redacted",
          clientSecret: "redacted",
          accessToken: "redacted",
          refreshToken: "redacted",
          showCoverArt: false
  }
}
]
};

Screenshots If applicable, add screenshots to help explain your problem. image

Additional context Add any other context about the problem here.

I saw two GitHub repo's with the same issue, although they weren't for magicmirror, they also used the same api https://github.com/csparpa/pyowm/issues/404 https://github.com/domoticz/domoticz/issues/5336

I guess instead of doing https://api.openweathermap.org/data/2.5/onecall?lat=33.44&lon=-94.04&exclude=hourly,daily&appid= you could do https://api.openweathermap.org/data/2.5/weather?lat=33.44&lon=-94.04&exclude=hourly,daily&appid= but that would require some tweaking in the code that i'm not knowledgable enough to do. I hope this is helpful enough

DarkPlayerr avatar Dec 23 '22 00:12 DarkPlayerr