Skip to content

Commit 5b6b1c1

Browse files
authored
Fix forecast URL and wind speed logic
Updated the forecast URL format and improved wind speed handling.
1 parent 96d3e87 commit 5b6b1c1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

modules/default/weather/providers/envcanada.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ WeatherProvider.register("envcanada", {
208208
* Fixed value + Prov code specified in Weather module Config.js + current hour as GMT
209209
*/
210210
getUrl () {
211-
let forecastURL = `https://dd.weather.gc.ca/citypage_weather/${this.config.provCode}`;
211+
let forecastURL = `https://dd.weather.gc.ca/today/citypage_weather/${this.config.provCode}`;
212212
const hour = this.getCurrentHourGMT();
213213
forecastURL += `/${hour}/`;
214214
return forecastURL;
@@ -243,8 +243,13 @@ WeatherProvider.register("envcanada", {
243243
} else {
244244
currentWeather.temperature = this.cacheCurrentTemp;
245245
}
246+
247+
if (ECdoc.querySelector("siteData currentConditions wind speed").textContent === "calm") {
248+
currentWeather.windSpeed = "0";
249+
} else {
250+
currentWeather.windSpeed = WeatherUtils.convertWindToMs(ECdoc.querySelector("siteData currentConditions wind speed").textContent);
251+
}
246252

247-
currentWeather.windSpeed = WeatherUtils.convertWindToMs(ECdoc.querySelector("siteData currentConditions wind speed").textContent);
248253
currentWeather.windFromDirection = ECdoc.querySelector("siteData currentConditions wind bearing").textContent;
249254

250255
currentWeather.humidity = ECdoc.querySelector("siteData currentConditions relativeHumidity").textContent;

0 commit comments

Comments
 (0)