mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Add openweathermap UV index support (#3145)
This PR adds UV index support to the openweathermap provider for the One Call api.
This commit is contained in:
parent
4b0e0aa48f
commit
62eb23ba6a
@ -11,6 +11,8 @@ _This release is scheduled to be released on 2023-10-01._
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- Added UV Index support to OpenWeatherMap
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
### Updated
|
### Updated
|
||||||
|
@ -295,6 +295,7 @@ WeatherProvider.register("openweathermap", {
|
|||||||
current.temperature = data.current.temp;
|
current.temperature = data.current.temp;
|
||||||
current.weatherType = this.convertWeatherType(data.current.weather[0].icon);
|
current.weatherType = this.convertWeatherType(data.current.weather[0].icon);
|
||||||
current.humidity = data.current.humidity;
|
current.humidity = data.current.humidity;
|
||||||
|
current.uv_index = data.current.uvi;
|
||||||
if (data.current.hasOwnProperty("rain") && !isNaN(data.current["rain"]["1h"])) {
|
if (data.current.hasOwnProperty("rain") && !isNaN(data.current["rain"]["1h"])) {
|
||||||
current.rain = data.current["rain"]["1h"];
|
current.rain = data.current["rain"]["1h"];
|
||||||
precip = true;
|
precip = true;
|
||||||
@ -323,6 +324,7 @@ WeatherProvider.register("openweathermap", {
|
|||||||
weather.windFromDirection = hour.wind_deg;
|
weather.windFromDirection = hour.wind_deg;
|
||||||
weather.weatherType = this.convertWeatherType(hour.weather[0].icon);
|
weather.weatherType = this.convertWeatherType(hour.weather[0].icon);
|
||||||
weather.precipitationProbability = hour.pop ? hour.pop * 100 : undefined;
|
weather.precipitationProbability = hour.pop ? hour.pop * 100 : undefined;
|
||||||
|
weather.uv_index = hour.uvi;
|
||||||
precip = false;
|
precip = false;
|
||||||
if (hour.hasOwnProperty("rain") && !isNaN(hour.rain["1h"])) {
|
if (hour.hasOwnProperty("rain") && !isNaN(hour.rain["1h"])) {
|
||||||
weather.rain = hour.rain["1h"];
|
weather.rain = hour.rain["1h"];
|
||||||
@ -355,6 +357,7 @@ WeatherProvider.register("openweathermap", {
|
|||||||
weather.windFromDirection = day.wind_deg;
|
weather.windFromDirection = day.wind_deg;
|
||||||
weather.weatherType = this.convertWeatherType(day.weather[0].icon);
|
weather.weatherType = this.convertWeatherType(day.weather[0].icon);
|
||||||
weather.precipitationProbability = day.pop ? day.pop * 100 : undefined;
|
weather.precipitationProbability = day.pop ? day.pop * 100 : undefined;
|
||||||
|
weather.uv_index = day.uvi;
|
||||||
precip = false;
|
precip = false;
|
||||||
if (!isNaN(day.rain)) {
|
if (!isNaN(day.rain)) {
|
||||||
weather.rain = day.rain;
|
weather.rain = day.rain;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user