delightedCrow / WallberryTheme

Bringing the WallberryTheme to MagicMirror²
MIT License
99 stars 21 forks source link

Invalid API key due to OneCall 2.5 being depreciated #45

Open DarkPlayerr opened 1 year ago

DarkPlayerr commented 1 year ago

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.

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

twalling commented 4 months ago

I'll take a look at this. I noticed it wasn't working and I'd like to use this weather module.

DarkPlayerr commented 4 months ago

I'll take a look at this. I noticed it wasn't working and I'd like to use this weather module.

i've seen some kind of recent fork that might've fixed this issue for us

i haven't gotten around to try it yet but the commits seem promising

https://github.com/KristjanESPERANTO/WallberryTheme/commit/9d7172582511d91ec51a0d6511091114ca418f86

twalling commented 4 months ago

I confirmed that PR worked. I had to also setup a subscription with openweathermap to use the new 3.0 API. They allow 1000 free calls per day.