diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b9ac1ac..280652d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ _This release is scheduled to be released on 2025-01-01._ - [updatenotification] Fix pm2 using detection when pm2 script is in MagicMirror root folder (#3576) - [core] Fix loading node_helper of modules: avoid black screen, display errors and continue loading with next module (#3578) +- [weather] changed default value for weatherEndpoint of provider openweathermap to "/onecall" (#3574) ## [2.29.0] - 2024-10-01 diff --git a/modules/default/weather/providers/openweathermap.js b/modules/default/weather/providers/openweathermap.js index 3f29ed55..dc902705 100644 --- a/modules/default/weather/providers/openweathermap.js +++ b/modules/default/weather/providers/openweathermap.js @@ -17,10 +17,13 @@ WeatherProvider.register("openweathermap", { defaults: { apiVersion: "3.0", apiBase: "https://api.openweathermap.org/data/", - weatherEndpoint: "", // can be "onecall", "forecast" or "weather" (for current) + // weatherEndpoint is "/onecall" since API 3.0 + // "/onecall", "/forecast" or "/weather" only for pro customers + weatherEndpoint: "/onecall", locationID: false, location: false, - lat: 0, // the onecall endpoint needs lat / lon values, it doesn't support the locationId + // the /onecall endpoint needs lat / lon values, it doesn't support the locationId + lat: 0, lon: 0, apiKey: "" }, @@ -90,30 +93,6 @@ WeatherProvider.register("openweathermap", { .finally(() => this.updateAvailable()); }, - /** - * Overrides method for setting config to check if endpoint is correct for hourly - * @param {object} config The configuration object - */ - setConfig (config) { - this.config = config; - if (!this.config.weatherEndpoint) { - switch (this.config.type) { - case "hourly": - this.config.weatherEndpoint = "/onecall"; - break; - case "daily": - case "forecast": - this.config.weatherEndpoint = "/forecast"; - break; - case "current": - this.config.weatherEndpoint = "/weather"; - break; - default: - Log.error("weatherEndpoint not configured and could not resolve it based on type"); - } - } - }, - /** OpenWeatherMap Specific Methods - These are not part of the default provider methods */ /* * Gets the complete url for the request diff --git a/tests/configs/modules/weather/currentweather_compliments.js b/tests/configs/modules/weather/currentweather_compliments.js index 25303fd3..73e58554 100644 --- a/tests/configs/modules/weather/currentweather_compliments.js +++ b/tests/configs/modules/weather/currentweather_compliments.js @@ -15,6 +15,8 @@ let config = { position: "bottom_bar", config: { location: "Munich", + weatherProvider: "openweathermap", + weatherEndpoint: "/weather", mockData: '"#####WEATHERDATA#####"' } } diff --git a/tests/configs/modules/weather/currentweather_default.js b/tests/configs/modules/weather/currentweather_default.js index b6601aa3..d2ad0a6b 100644 --- a/tests/configs/modules/weather/currentweather_default.js +++ b/tests/configs/modules/weather/currentweather_default.js @@ -8,6 +8,8 @@ let config = { config: { location: "Munich", showHumidity: "feelslike", + weatherProvider: "openweathermap", + weatherEndpoint: "/weather", mockData: '"#####WEATHERDATA#####"' } } diff --git a/tests/configs/modules/weather/currentweather_options.js b/tests/configs/modules/weather/currentweather_options.js index f7c2e3f1..903d3df7 100644 --- a/tests/configs/modules/weather/currentweather_options.js +++ b/tests/configs/modules/weather/currentweather_options.js @@ -5,6 +5,8 @@ let config = { position: "bottom_bar", config: { location: "Munich", + weatherProvider: "openweathermap", + weatherEndpoint: "/weather", mockData: '"#####WEATHERDATA#####"', windUnits: "beaufort", showWindDirectionAsArrow: true, diff --git a/tests/configs/modules/weather/currentweather_units.js b/tests/configs/modules/weather/currentweather_units.js index eedbc37d..856acf26 100644 --- a/tests/configs/modules/weather/currentweather_units.js +++ b/tests/configs/modules/weather/currentweather_units.js @@ -7,6 +7,8 @@ let config = { position: "bottom_bar", config: { location: "Munich", + weatherProvider: "openweathermap", + weatherEndpoint: "/weather", mockData: '"#####WEATHERDATA#####"', decimalSymbol: ",", showHumidity: "wind" diff --git a/tests/configs/modules/weather/forecastweather_absolute.js b/tests/configs/modules/weather/forecastweather_absolute.js index a2640d30..4b3884fe 100644 --- a/tests/configs/modules/weather/forecastweather_absolute.js +++ b/tests/configs/modules/weather/forecastweather_absolute.js @@ -8,8 +8,9 @@ let config = { config: { type: "forecast", location: "Munich", - mockData: '"#####WEATHERDATA#####"', + weatherProvider: "openweathermap", weatherEndpoint: "/forecast/daily", + mockData: '"#####WEATHERDATA#####"', absoluteDates: true } } diff --git a/tests/configs/modules/weather/forecastweather_default.js b/tests/configs/modules/weather/forecastweather_default.js index 4cddef62..3192b4c9 100644 --- a/tests/configs/modules/weather/forecastweather_default.js +++ b/tests/configs/modules/weather/forecastweather_default.js @@ -8,8 +8,9 @@ let config = { config: { type: "forecast", location: "Munich", - mockData: '"#####WEATHERDATA#####"', - weatherEndpoint: "/forecast/daily" + weatherProvider: "openweathermap", + weatherEndpoint: "/forecast/daily", + mockData: '"#####WEATHERDATA#####"' } } ] diff --git a/tests/configs/modules/weather/forecastweather_options.js b/tests/configs/modules/weather/forecastweather_options.js index 0eea8292..ec55dc6c 100644 --- a/tests/configs/modules/weather/forecastweather_options.js +++ b/tests/configs/modules/weather/forecastweather_options.js @@ -8,8 +8,9 @@ let config = { config: { type: "forecast", location: "Munich", - mockData: '"#####WEATHERDATA#####"', + weatherProvider: "openweathermap", weatherEndpoint: "/forecast/daily", + mockData: '"#####WEATHERDATA#####"', showPrecipitationAmount: true, colored: true, tableClass: "myTableClass" diff --git a/tests/configs/modules/weather/forecastweather_units.js b/tests/configs/modules/weather/forecastweather_units.js index 8ac58a43..b9ba11e7 100644 --- a/tests/configs/modules/weather/forecastweather_units.js +++ b/tests/configs/modules/weather/forecastweather_units.js @@ -8,8 +8,9 @@ let config = { config: { type: "forecast", location: "Munich", - mockData: '"#####WEATHERDATA#####"', + weatherProvider: "openweathermap", weatherEndpoint: "/forecast/daily", + mockData: '"#####WEATHERDATA#####"', decimalSymbol: "_", showPrecipitationAmount: true } diff --git a/tests/configs/modules/weather/hourlyweather_default.js b/tests/configs/modules/weather/hourlyweather_default.js index 8e46b44c..ed6f66db 100644 --- a/tests/configs/modules/weather/hourlyweather_default.js +++ b/tests/configs/modules/weather/hourlyweather_default.js @@ -8,6 +8,8 @@ let config = { config: { type: "hourly", location: "Berlin", + weatherProvider: "openweathermap", + weatherEndpoint: "/onecall", mockData: '"#####WEATHERDATA#####"' } } diff --git a/tests/configs/modules/weather/hourlyweather_options.js b/tests/configs/modules/weather/hourlyweather_options.js index b37fd7b9..5422075e 100644 --- a/tests/configs/modules/weather/hourlyweather_options.js +++ b/tests/configs/modules/weather/hourlyweather_options.js @@ -8,6 +8,8 @@ let config = { config: { type: "hourly", location: "Berlin", + weatherProvider: "openweathermap", + weatherEndpoint: "/onecall", mockData: '"#####WEATHERDATA#####"', hourlyForecastIncrements: 2 } diff --git a/tests/configs/modules/weather/hourlyweather_showPrecipitation.js b/tests/configs/modules/weather/hourlyweather_showPrecipitation.js index 0e79858f..1448172f 100644 --- a/tests/configs/modules/weather/hourlyweather_showPrecipitation.js +++ b/tests/configs/modules/weather/hourlyweather_showPrecipitation.js @@ -8,6 +8,8 @@ let config = { config: { type: "hourly", location: "Berlin", + weatherProvider: "openweathermap", + weatherEndpoint: "/onecall", mockData: '"#####WEATHERDATA#####"', showPrecipitationAmount: true, showPrecipitationProbability: true