diff --git a/CHANGELOG.md b/CHANGELOG.md index ab0eb781..4942c69a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ planned for 2026-01-01 - feat: add ESlint rule `no-sparse-arrays` for config check to fix #3910 (#3911) - fixed eslint warnings shown in #3911 and updated npm publish docs (#3913) - [core] refactor: replace `express-ipfilter` with lightweight custom middleware (#3917) - This fixes security issue [CVE-2023-42282](https://github.com/advisories/GHSA-78xj-cgh5-2h22), which is not very likely to be exploitable in MagicMirror² setups, but still should be fixed. +- fixed the Environment Canada weather URL (#3912) and now converts a windspeed of 'calm' to 0 ### Updated diff --git a/modules/default/weather/providers/envcanada.js b/modules/default/weather/providers/envcanada.js index cf397c55..43d57da6 100644 --- a/modules/default/weather/providers/envcanada.js +++ b/modules/default/weather/providers/envcanada.js @@ -208,7 +208,7 @@ WeatherProvider.register("envcanada", { * Fixed value + Prov code specified in Weather module Config.js + current hour as GMT */ getUrl () { - let forecastURL = `https://dd.weather.gc.ca/citypage_weather/${this.config.provCode}`; + let forecastURL = `https://dd.weather.gc.ca/today/citypage_weather/${this.config.provCode}`; const hour = this.getCurrentHourGMT(); forecastURL += `/${hour}/`; return forecastURL; @@ -244,7 +244,12 @@ WeatherProvider.register("envcanada", { currentWeather.temperature = this.cacheCurrentTemp; } - currentWeather.windSpeed = WeatherUtils.convertWindToMs(ECdoc.querySelector("siteData currentConditions wind speed").textContent); + if (ECdoc.querySelector("siteData currentConditions wind speed").textContent === "calm") { + currentWeather.windSpeed = "0"; + } else { + currentWeather.windSpeed = WeatherUtils.convertWindToMs(ECdoc.querySelector("siteData currentConditions wind speed").textContent); + } + currentWeather.windFromDirection = ECdoc.querySelector("siteData currentConditions wind bearing").textContent; currentWeather.humidity = ECdoc.querySelector("siteData currentConditions relativeHumidity").textContent;