From ac9da42054054a7201ae82800ae2540f1f7f6b7f Mon Sep 17 00:00:00 2001 From: HeikoGr <20295490+HeikoGr@users.noreply.github.com> Date: Wed, 9 Oct 2024 21:32:54 +0200 Subject: [PATCH 1/7] change default for weatherEndpoint according to API 3.0 --- CHANGELOG.md | 20 +++++++++++++++++++ .../weather/providers/openweathermap.js | 7 +++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30de4cd9ba..245818a903 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,26 @@ This project adheres to [Semantic Versioning](https://semver.org/). ❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/#donate) With your help we can continue to improve the MagicMirror². +## [2.30.0] - 2025-01-01 + +Thanks to: @HeikoGr + +> ⚠️ This release needs nodejs version `v20` or `v22`, minimum version is `v20.9.0` + +### Added + +### Removed + +### Updated + +### Fixed + +- [weather] changed default value for weatherEndpoint to "/onecall" (#3574) + +### Deleted + +- [weather] + ## [2.29.0] - 2024-10-01 Thanks to: @bugsounet, @dkallen78, @jargordon, @khassel, @KristjanESPERANTO, @MarcLandis, @rejas, @ryan-d-williams, @sdetweil, @skpanagiotis. diff --git a/modules/default/weather/providers/openweathermap.js b/modules/default/weather/providers/openweathermap.js index 3f29ed5562..d78f7fe3d8 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: "" }, From e859271ccc2a7cd1dae609678e27ba49c8e5a046 Mon Sep 17 00:00:00 2001 From: HeikoGr <20295490+HeikoGr@users.noreply.github.com> Date: Wed, 9 Oct 2024 21:57:54 +0200 Subject: [PATCH 2/7] Update CHANGELOG.md did't checkout develop. my fault. Sorry. --- CHANGELOG.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 245818a903..42b867d8c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,26 +5,26 @@ This project adheres to [Semantic Versioning](https://semver.org/). ❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/#donate) With your help we can continue to improve the MagicMirror². -## [2.30.0] - 2025-01-01 +## [2.30.0] - Unreleased (`develop` branch) -Thanks to: @HeikoGr - -> ⚠️ This release needs nodejs version `v20` or `v22`, minimum version is `v20.9.0` +_This release is scheduled to be released on 2025-01-01._ ### Added ### Removed +- [tests] Removed node-pty and drivelist from rebuilded test (#3575) + ### Updated +- [repo] reactivated `stale.yaml` as github action to mark issues as stale after 60 days and close them 7 days later (if no activity) + ### Fixed +- [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 to "/onecall" (#3574) -### Deleted - -- [weather] - ## [2.29.0] - 2024-10-01 Thanks to: @bugsounet, @dkallen78, @jargordon, @khassel, @KristjanESPERANTO, @MarcLandis, @rejas, @ryan-d-williams, @sdetweil, @skpanagiotis. From dda63cdb405d942cc7d79ccdc78875cada297582 Mon Sep 17 00:00:00 2001 From: HeikoGr <20295490+HeikoGr@users.noreply.github.com> Date: Wed, 9 Oct 2024 22:29:01 +0200 Subject: [PATCH 3/7] Update openweathermap.js remove leading slash --- modules/default/weather/providers/openweathermap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/default/weather/providers/openweathermap.js b/modules/default/weather/providers/openweathermap.js index d78f7fe3d8..6604a4df49 100644 --- a/modules/default/weather/providers/openweathermap.js +++ b/modules/default/weather/providers/openweathermap.js @@ -17,9 +17,9 @@ WeatherProvider.register("openweathermap", { defaults: { apiVersion: "3.0", apiBase: "https://api.openweathermap.org/data/", - // weatherEndpoint is "/onecall" since API 3.0 + // weatherEndpoint is "onecall" since API 3.0 // "onecall", "forecast" or "weather" only for pro customers - weatherEndpoint: "/onecall", + weatherEndpoint: "onecall", locationID: false, location: false, // the onecall endpoint needs lat / lon values, it doesn't support the locationId From 4aba437c305dffa1bdaa3b75a900692864f49249 Mon Sep 17 00:00:00 2001 From: HeikoGr <20295490+HeikoGr@users.noreply.github.com> Date: Thu, 10 Oct 2024 20:35:33 +0200 Subject: [PATCH 4/7] Update modules/default/weather/providers/openweathermap.js Co-authored-by: Pedro Lamas --- modules/default/weather/providers/openweathermap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/weather/providers/openweathermap.js b/modules/default/weather/providers/openweathermap.js index 6604a4df49..b1bf5c34d1 100644 --- a/modules/default/weather/providers/openweathermap.js +++ b/modules/default/weather/providers/openweathermap.js @@ -19,7 +19,7 @@ WeatherProvider.register("openweathermap", { apiBase: "https://api.openweathermap.org/data/", // weatherEndpoint is "onecall" since API 3.0 // "onecall", "forecast" or "weather" only for pro customers - weatherEndpoint: "onecall", + weatherEndpoint: "/onecall", locationID: false, location: false, // the onecall endpoint needs lat / lon values, it doesn't support the locationId From 0d2afe36c3855f7fa25c871f2023dca91d74502e Mon Sep 17 00:00:00 2001 From: HeikoGr <20295490+HeikoGr@users.noreply.github.com> Date: Thu, 10 Oct 2024 20:38:09 +0200 Subject: [PATCH 5/7] Update openweathermap.js update case select of endpoint --- modules/default/weather/providers/openweathermap.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/default/weather/providers/openweathermap.js b/modules/default/weather/providers/openweathermap.js index b1bf5c34d1..972cfa766e 100644 --- a/modules/default/weather/providers/openweathermap.js +++ b/modules/default/weather/providers/openweathermap.js @@ -17,12 +17,12 @@ WeatherProvider.register("openweathermap", { defaults: { apiVersion: "3.0", apiBase: "https://api.openweathermap.org/data/", - // weatherEndpoint is "onecall" since API 3.0 - // "onecall", "forecast" or "weather" only for pro customers + // weatherEndpoint is "/onecall" since API 3.0 + // "/onecall", "/forecast" or "/weather" only for pro customers weatherEndpoint: "/onecall", locationID: false, location: false, - // 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: "" @@ -102,14 +102,10 @@ WeatherProvider.register("openweathermap", { 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"; + this.config.weatherEndpoint = "/onecall"; break; default: Log.error("weatherEndpoint not configured and could not resolve it based on type"); From 2902a3b8af57474a5f369293021a06d4e355c10f Mon Sep 17 00:00:00 2001 From: HeikoGr <20295490+HeikoGr@users.noreply.github.com> Date: Thu, 10 Oct 2024 21:02:50 +0200 Subject: [PATCH 6/7] Update openweathermap.js --- modules/default/weather/providers/openweathermap.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/default/weather/providers/openweathermap.js b/modules/default/weather/providers/openweathermap.js index 972cfa766e..720d6c90c6 100644 --- a/modules/default/weather/providers/openweathermap.js +++ b/modules/default/weather/providers/openweathermap.js @@ -105,6 +105,7 @@ WeatherProvider.register("openweathermap", { case "daily": case "forecast": case "current": + case "": this.config.weatherEndpoint = "/onecall"; break; default: From 45f04bcda13969600cced751507ab585248daa02 Mon Sep 17 00:00:00 2001 From: Karsten Hassel Date: Thu, 10 Oct 2024 22:13:15 +0200 Subject: [PATCH 7/7] remove setConfig in openweathermap.js, add weatherProvider and weatherEndpoint to all weather test configs --- .../weather/providers/openweathermap.js | 21 ------------------- .../weather/currentweather_compliments.js | 2 ++ .../modules/weather/currentweather_default.js | 2 ++ .../modules/weather/currentweather_options.js | 2 ++ .../modules/weather/currentweather_units.js | 2 ++ .../weather/forecastweather_absolute.js | 3 ++- .../weather/forecastweather_default.js | 5 +++-- .../weather/forecastweather_options.js | 3 ++- .../modules/weather/forecastweather_units.js | 3 ++- .../modules/weather/hourlyweather_default.js | 2 ++ .../modules/weather/hourlyweather_options.js | 2 ++ .../hourlyweather_showPrecipitation.js | 2 ++ 12 files changed, 23 insertions(+), 26 deletions(-) diff --git a/modules/default/weather/providers/openweathermap.js b/modules/default/weather/providers/openweathermap.js index 720d6c90c6..dc902705ce 100644 --- a/modules/default/weather/providers/openweathermap.js +++ b/modules/default/weather/providers/openweathermap.js @@ -93,27 +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": - case "daily": - case "forecast": - case "current": - case "": - this.config.weatherEndpoint = "/onecall"; - 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 25303fd3cb..73e5855453 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 b6601aa378..d2ad0a6bf4 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 f7c2e3f116..903d3df760 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 eedbc37de8..856acf2635 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 a2640d3025..4b3884fe3a 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 4cddef62fa..3192b4c9dc 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 0eea8292ed..ec55dc6cd1 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 8ac58a43b0..b9ba11e79c 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 8e46b44cab..ed6f66db39 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 b37fd7b9f1..5422075e6d 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 0e79858f16..1448172f81 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