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:
Knapoc
2023-07-02 21:47:25 +02:00
committed by GitHub
parent 4b0e0aa48f
commit 62eb23ba6a
2 changed files with 5 additions and 0 deletions

View File

@@ -295,6 +295,7 @@ WeatherProvider.register("openweathermap", {
current.temperature = data.current.temp;
current.weatherType = this.convertWeatherType(data.current.weather[0].icon);
current.humidity = data.current.humidity;
current.uv_index = data.current.uvi;
if (data.current.hasOwnProperty("rain") && !isNaN(data.current["rain"]["1h"])) {
current.rain = data.current["rain"]["1h"];
precip = true;
@@ -323,6 +324,7 @@ WeatherProvider.register("openweathermap", {
weather.windFromDirection = hour.wind_deg;
weather.weatherType = this.convertWeatherType(hour.weather[0].icon);
weather.precipitationProbability = hour.pop ? hour.pop * 100 : undefined;
weather.uv_index = hour.uvi;
precip = false;
if (hour.hasOwnProperty("rain") && !isNaN(hour.rain["1h"])) {
weather.rain = hour.rain["1h"];
@@ -355,6 +357,7 @@ WeatherProvider.register("openweathermap", {
weather.windFromDirection = day.wind_deg;
weather.weatherType = this.convertWeatherType(day.weather[0].icon);
weather.precipitationProbability = day.pop ? day.pop * 100 : undefined;
weather.uv_index = day.uvi;
precip = false;
if (!isNaN(day.rain)) {
weather.rain = day.rain;