mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Update yr provider to new api (#3197)
Some changes after yr api was deprecated and replaced with a new one. Fixes #3189
This commit is contained in:
parent
4eccce3f77
commit
8b1c279c07
@ -91,6 +91,7 @@ Special thanks to @khassel, @rejas and @sdetweil for taking over most (if not al
|
||||
- Fix date not shown when clock in analog mode (#3100)
|
||||
- Fix envcanada today percentage-of-precipitation (#3106)
|
||||
- Fix updatenotification where no branch is checked out but e.g. a version tag (#3130)
|
||||
- Fix yr weather provider after changes in yr API (#3189)
|
||||
|
||||
## [2.23.0] - 2023-04-04
|
||||
|
||||
|
@ -352,8 +352,7 @@ WeatherProvider.register("yr", {
|
||||
if (hours.length < 2) {
|
||||
hours = `0${hours}`;
|
||||
}
|
||||
|
||||
return `${this.config.apiBase}/sunrise/2.0/.json?date=${date}&days=${days}&height=${altitude}&lat=${lat}&lon=${lon}&offset=${utcOffsetPrefix}${hours}%3A${minutes}`;
|
||||
return `${this.config.apiBase}/sunrise/2.3/sun?lat=${lat}&lon=${lon}&date=${date}&offset=${utcOffsetPrefix}${hours}%3A${minutes}`;
|
||||
},
|
||||
|
||||
cacheStellarData(data) {
|
||||
@ -362,8 +361,6 @@ WeatherProvider.register("yr", {
|
||||
|
||||
getWeatherDataFrom(forecast, stellarData, units) {
|
||||
const weather = new WeatherObject();
|
||||
const stellarTimesToday = stellarData?.today ? this.getStellarTimesFrom(stellarData.today, moment().format("YYYY-MM-DD")) : undefined;
|
||||
const stellarTimesTomorrow = stellarData?.tomorrow ? this.getStellarTimesFrom(stellarData.tomorrow, moment().add(1, "days").format("YYYY-MM-DD")) : undefined;
|
||||
|
||||
weather.date = moment(forecast.time);
|
||||
weather.windSpeed = forecast.data.instant.details.wind_speed;
|
||||
@ -377,10 +374,8 @@ WeatherProvider.register("yr", {
|
||||
weather.precipitationProbability = forecast.precipitationProbability;
|
||||
weather.precipitationUnits = units.precipitation_amount;
|
||||
|
||||
if (stellarTimesToday) {
|
||||
weather.sunset = moment(stellarTimesToday.sunset.time);
|
||||
weather.sunrise = weather.sunset < moment() && stellarTimesTomorrow ? moment(stellarTimesTomorrow.sunrise.time) : moment(stellarTimesToday.sunrise.time);
|
||||
}
|
||||
weather.sunrise = stellarData?.today?.properties?.sunrise?.time;
|
||||
weather.sunset = stellarData?.today?.properties?.sunset?.time;
|
||||
|
||||
return weather;
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user