diff --git a/CHANGELOG.md b/CHANGELOG.md
index 507f389b..be163e0b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ _This release is scheduled to be released on 2023-07-01._
### Added
+- Added UV Index to hourly and current Weather, with support for Openmeteo
- Added tests for serveronly
- Set Timezone `Europe/Berlin` in unit tests (needed for new formatTime tests)
- Added no-param-reassign eslint rule and fix warnings
diff --git a/modules/default/weather/current.njk b/modules/default/weather/current.njk
index df673afe..09781db7 100644
--- a/modules/default/weather/current.njk
+++ b/modules/default/weather/current.njk
@@ -28,6 +28,12 @@
{% endif %}
{% endif %}
+ {% if config.showUVIndex %}
+
+
+ {{ current.uv_index }}
+ |
+ {% endif %}
{% endif %}
@@ -61,12 +67,12 @@
{{ "FEELS" | translate({DEGREE: current.feelsLike() | roundValue | unit("temperature") | decimalSymbol }) }}
{% endif %}
- {% if config.showPrecipitationAmount and current.precipitationAmount %}
+ {% if config.showPrecipitationAmount and current.precipitationAmount %}
{{ "PRECIP_AMOUNT" | translate }} {{ current.precipitationAmount | unit("precip", current.precipitationUnits) }}
{% endif %}
- {% if config.showPrecipitationProbability and current.precipitationProbability %}
+ {% if config.showPrecipitationProbability and current.precipitationProbability %}
{{ "PRECIP_POP" | translate }} {{ current.precipitationProbability }}%
diff --git a/modules/default/weather/forecast.njk b/modules/default/weather/forecast.njk
index 0ea390f0..af5825e3 100644
--- a/modules/default/weather/forecast.njk
+++ b/modules/default/weather/forecast.njk
@@ -32,6 +32,12 @@
{{ f.precipitationProbability | unit("precip", "%") }}
{% endif %}
+ {% if config.showUVIndex %}
+
+ {{ f.uv_index }}
+
+ |
+ {% endif %}
{% set currentStep = currentStep + 1 %}
{% endfor %}
diff --git a/modules/default/weather/hourly.njk b/modules/default/weather/hourly.njk
index a0699fab..51fb67d5 100644
--- a/modules/default/weather/hourly.njk
+++ b/modules/default/weather/hourly.njk
@@ -10,6 +10,14 @@
{{ hour.temperature | roundValue | unit("temperature") }}
|
+ {% if config.showUVIndex %}
+
+ {% if hour.uv_index!=0 %}
+ {{ hour.uv_index }}
+
+ {% endif %}
+ |
+ {% endif %}
{% if config.showPrecipitationAmount %}
{{ hour.precipitationAmount | unit("precip", hour.precipitationUnits) }}
diff --git a/modules/default/weather/providers/openmeteo.js b/modules/default/weather/providers/openmeteo.js
index 73d5e3bd..79d7d1fa 100644
--- a/modules/default/weather/providers/openmeteo.js
+++ b/modules/default/weather/providers/openmeteo.js
@@ -76,8 +76,10 @@ WeatherProvider.register("openmeteo", {
"et0_fao_evapotranspiration",
// Total precipitation (rain, showers, snow) sum of the preceding hour
"precipitation",
- //Precipitation Probability
+ // Precipitation Probability
"precipitation_probability",
+ // UV index
+ "uv_index",
// Snowfall amount of the preceding hour in centimeters. For the water equivalent in millimeter, divide by 7. E.g. 7 cm snow = 10 mm precipitation water equivalent
"snowfall",
// Rain from large scale weather systems of the preceding hour in millimeter
@@ -132,6 +134,8 @@ WeatherProvider.register("openmeteo", {
"winddirection_10m_dominant",
// The sum of solar radiation on a given day in Megajoules
"shortwave_radiation_sum",
+ //UV Index
+ "uv_index_max",
// Daily sum of ETâ‚€ Reference Evapotranspiration of a well watered grass field
"et0_fao_evapotranspiration"
],
@@ -383,7 +387,8 @@ WeatherProvider.register("openmeteo", {
currentWeather.rain = parseFloat(weather.hourly[h].rain);
currentWeather.snow = parseFloat(weather.hourly[h].snowfall * 10);
currentWeather.precipitationAmount = parseFloat(weather.hourly[h].precipitation);
- currentWeather.precipitationProbability = parseFloat(weather.precipitation_probability);
+ currentWeather.precipitationProbability = parseFloat(weather.hourly[h].precipitation_probability);
+ currentWeather.uv_index = parseFloat(weather.hourly[h].uv_index);
return currentWeather;
},
@@ -408,6 +413,7 @@ WeatherProvider.register("openmeteo", {
currentWeather.snow = parseFloat(weather.snowfall_sum * 10);
currentWeather.precipitationAmount = parseFloat(weather.precipitation_sum);
currentWeather.precipitationProbability = parseFloat(weather.precipitation_probability);
+ currentWeather.uv_index = parseFloat(weather.uv_index_max);
days.push(currentWeather);
});
@@ -442,6 +448,7 @@ WeatherProvider.register("openmeteo", {
currentWeather.snow = parseFloat(weather.snowfall * 10);
currentWeather.precipitationAmount = parseFloat(weather.precipitation);
currentWeather.precipitationProbability = parseFloat(weather.precipitation_probability);
+ currentWeather.uv_index = parseFloat(weather.uv_index);
hours.push(currentWeather);
});
diff --git a/modules/default/weather/weather.css b/modules/default/weather/weather.css
index c2b7fe5e..816f0a9b 100644
--- a/modules/default/weather/weather.css
+++ b/modules/default/weather/weather.css
@@ -30,7 +30,8 @@
}
.weather .precipitation-amount,
-.weather .precipitation-prob {
+.weather .precipitation-prob,
+.weather .uv-index {
padding-left: 20px;
padding-right: 0;
}
diff --git a/modules/default/weather/weather.js b/modules/default/weather/weather.js
index 53264ccd..08f754c2 100644
--- a/modules/default/weather/weather.js
+++ b/modules/default/weather/weather.js
@@ -27,6 +27,7 @@ Module.register("weather", {
showPeriodUpper: false,
showPrecipitationAmount: false,
showPrecipitationProbability: false,
+ showUVIndex: false,
showSun: true,
showWindDirection: true,
showWindDirectionAsArrow: false,
|