mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
Fixed probability of precipitation in weathergov.js (#3195)
Fixes https://github.com/MichMich/MagicMirror/issues/3182 Fixed issue with probability of precipitation not showing up on hourly or daily forecast --------- Co-authored-by: veeck <michael.veeck@nebenan.de>
This commit is contained in:
parent
ad665a7a33
commit
a3c2e7b816
@ -52,6 +52,7 @@ _This release is scheduled to be released on 2023-10-01._
|
|||||||
- Fix: AnimateCSS merge hide() and show() animated css class when we do multiple call
|
- Fix: AnimateCSS merge hide() and show() animated css class when we do multiple call
|
||||||
- Fix `Uncaught SyntaxError: Identifier 'getCorsUrl' has already been declared (at utils.js:1:1)` when using `clock` and `weather` module (#3204)
|
- Fix `Uncaught SyntaxError: Identifier 'getCorsUrl' has already been declared (at utils.js:1:1)` when using `clock` and `weather` module (#3204)
|
||||||
- Fix overriding `config.js` when running tests (#3201)
|
- Fix overriding `config.js` when running tests (#3201)
|
||||||
|
- Fix issue in weathergov provider with probability of precipitation not showing up on hourly or daily forecast
|
||||||
|
|
||||||
## [2.24.0] - 2023-07-01
|
## [2.24.0] - 2023-07-01
|
||||||
|
|
||||||
|
@ -182,6 +182,12 @@ WeatherProvider.register("weathergov", {
|
|||||||
weather.windSpeed = WeatherUtils.convertWindToMs(weather.windSpeed);
|
weather.windSpeed = WeatherUtils.convertWindToMs(weather.windSpeed);
|
||||||
weather.windFromDirection = forecast.windDirection;
|
weather.windFromDirection = forecast.windDirection;
|
||||||
weather.temperature = forecast.temperature;
|
weather.temperature = forecast.temperature;
|
||||||
|
//assign probability of precipitation
|
||||||
|
if (forecast.probabilityOfPrecipitation.value === null) {
|
||||||
|
weather.precipitationProbability = 0;
|
||||||
|
} else {
|
||||||
|
weather.precipitationProbability = forecast.probabilityOfPrecipitation.value;
|
||||||
|
}
|
||||||
// use the forecast isDayTime attribute to help build the weatherType label
|
// use the forecast isDayTime attribute to help build the weatherType label
|
||||||
weather.weatherType = this.convertWeatherType(forecast.shortForecast, forecast.isDaytime);
|
weather.weatherType = this.convertWeatherType(forecast.shortForecast, forecast.isDaytime);
|
||||||
|
|
||||||
@ -238,8 +244,6 @@ WeatherProvider.register("weathergov", {
|
|||||||
* fetch forecast information for daily forecast.
|
* fetch forecast information for daily forecast.
|
||||||
*/
|
*/
|
||||||
fetchForecastDaily(forecasts) {
|
fetchForecastDaily(forecasts) {
|
||||||
const precipitationProbabilityRegEx = "Chance of precipitation is ([0-9]+?)%";
|
|
||||||
|
|
||||||
// initial variable declaration
|
// initial variable declaration
|
||||||
const days = [];
|
const days = [];
|
||||||
// variables for temperature range and rain
|
// variables for temperature range and rain
|
||||||
@ -262,8 +266,12 @@ WeatherProvider.register("weathergov", {
|
|||||||
|
|
||||||
minTemp = [];
|
minTemp = [];
|
||||||
maxTemp = [];
|
maxTemp = [];
|
||||||
const precipitation = new RegExp(precipitationProbabilityRegEx, "g").exec(forecast.detailedForecast);
|
//assign probability of precipitation
|
||||||
if (precipitation) weather.precipitationProbability = precipitation[1];
|
if (forecast.probabilityOfPrecipitation.value === null) {
|
||||||
|
weather.precipitationProbability = 0;
|
||||||
|
} else {
|
||||||
|
weather.precipitationProbability = forecast.probabilityOfPrecipitation.value;
|
||||||
|
}
|
||||||
|
|
||||||
// set new date
|
// set new date
|
||||||
date = moment(forecast.startTime).format("YYYY-MM-DD");
|
date = moment(forecast.startTime).format("YYYY-MM-DD");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user