I like to hand over another Christmas present to you. The first extension of the OpenWeatherMap Binding:
Support for UV Index API
::: tip Note
The product will retire on 1st April 2021, please find UV data in the One Call API.
One Call API includes current, hourly forecast for 7 days and 5 days historical UV data.
:::
Nothing spectacular but maybe a nice enhancement for somebody. The implementation adds support for the current UV Index and forecasted UV Index (up to 8 days, including today) for a specific location.
Have a look at the documentation documentation for an example.
Extended example
This example requires the Scale Transformation Service (colors and scale are based on Ultraviolet index - Wikipedia).
things/openweathermap.things
Bridge openweathermap:weather-api:api "OpenWeatherMap Account" [apikey="AAA", refreshInterval=30] {
Thing uvindex local "Local UV Index" [location="XXX,YYY", forecastDays=4]
}
icons/classic/uvindex.svg
items/uvindex.items
Number owmUVIndex "UV Index [%.1f]" <uvindex> ["Wetter","UV-Index"] { channel="openweathermap:uvindex:api:local:current#uvindex" }
DateTime owmUVIndexLastChange "Last Change [%1$tY-%1$tm-%1$td]" <time> { channel="openweathermap:uvindex:api:local:current#time-stamp" }
Number owmUVIndexTomorrow "UV Index (Tomorrow) [%.1f]" <uvindex> { channel="openweathermap:uvindex:api:local:forecastTomorrow#uvindex" }
DateTime owmUVIndexLastChangeTomorrow "Forecast Date [%1$tY-%1$tm-%1$td]" <time> { channel="openweathermap:uvindex:api:local:forecastTomorrow#time-stamp" }
Number owmUVIndexDay2 "UV Index (in 2 days) [%.1f]" <uvindex> { channel="openweathermap:uvindex:api:local:forecastDay2#uvindex" }
DateTime owmUVIndexLastChangeDay2 "Forecast Date [%1$tY-%1$tm-%1$td]" <time> { channel="openweathermap:uvindex:api:local:forecastDay2#time-stamp" }
Number owmUVIndexDay3 "UV Index (in 3 days) [%.1f]" <uvindex> { channel="openweathermap:uvindex:api:local:forecastDay3#uvindex" }
DateTime owmUVIndexLastChangeDay3 "Forecast Date [%1$tY-%1$tm-%1$td]" <time> { channel="openweathermap:uvindex:api:local:forecastDay3#time-stamp" }
transform/uvindex.scale
[..3[=Low
[3..6[=Moderate
[6..8[=High
[8..11[=Very high
[11..]=Extreme
sitemap/uvindex.sitemap
sitemap uvindex label="OpenWeatherMap - UV Index" {
Frame label="UV Index" {
Text item=owmUVIndex valuecolor=[<3="green", <6="yellow", <8="orange", <11="red", >=11="purple"] {
Frame label="UV-Index (Tomorrow)" {
Text item=owmUVIndexTomorrow valuecolor=[<3="green", <6="yellow", <8="orange", <11="red", >=11="purple"]
Text item=owmUVIndexTomorrow label="UV-Index (Tomorrow) [SCALE(uvindex.scale):%s]" valuecolor=[<3="green", <6="yellow", <8="orange", <11="red", >=11="purple"]
Text item=owmUVIndexLastChangeTomorrow
}
Frame label="UV Index (in 2 days)" {
Text item=owmUVIndexDay2 valuecolor=[<3="green", <6="yellow", <8="orange", <11="red", >=11="purple"]
Text item=owmUVIndexDay2 label="UV Index (in 2 days) [SCALE(uvindex.scale):%s]" valuecolor=[<3="green", <6="yellow", <8="orange", <11="red", >=11="purple"]
Text item=owmUVIndexLastChangeDay2
}
Frame label="UV Index (in 3 days)" {
Text item=owmUVIndexDay3 valuecolor=[<3="green", <6="yellow", <8="orange", <11="red", >=11="purple"]
Text item=owmUVIndexDay3 label="UV Index (in 3 days) [SCALE(uvindex.scale):%s]" valuecolor=[<3="green", <6="yellow", <8="orange", <11="red", >=11="purple"]
Text item=owmUVIndexLastChangeDay3
}
}
Text item=owmUVIndex label="UV Index [SCALE(uvindex.scale):%s]" valuecolor=[<3="green", <6="yellow", <8="orange", <11="red", >=11="purple"]
Text item=owmUVIndexLastChange
}
}
Have fun.