OpenWeatherMap Extension - Support for UV Index API

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

uvindex

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.

5 Likes

Tips & Tricks

1 Like

Hi,
I would like to give UV a go (and I think the new snapshot also supports wind gusts too :smile:)
To add the new snapshot on to OH2.4 I download the jar file and copy it to my add-ons directory and then what?
I do not see an additional UV thing listed.

Thanks

Paul

So I uninstalled the existing OH2.4 OWM binding and then installed again picking up the SNAPSHOT I had placed in my addon directory.
The new thing (UV Index) was automatically discovered and I added as a thing, yay!

I copied your examples and it seems to be working correctly, not sure that the scale has any longevity to it as I see we are set as extreme every day :frowning:
I can only imaging more protected areas will eventually get less protection from the suns rays and will make this scale almost useless. perhaps it needs turning on its head, only go out when the level is below X; that would mean we start doing more outdoor activities in the evenings and overnight , anyway I have rambled way off topic… Sorry!

I still did not find the wind gust channels are they included?

Thanks
Paul

Not sure if this is a bug with the extension or not.
look at the screen-shot and you will see it is 5/1/2019 and this is reflected too in the last measurement date-time stamp but check out the UV date it thinks it is already the 6th, and tomorrow it thinks is the 7th and so on.

Thanks

Paul

Hi Paul,

I cannot tell you very much without knowing which item / channel is behind your sitemap. Can you provide a TRACE log of the request/response? In which timezone do you live? Thanks.

The sitemap is using your demo setup.
I am in New Zealand. UTC +12 NZST but currently we are in daylight saving mode so its UTC +13 (NZDT)

can you advise the best way to get the trace log you would need please.

here is the sitemap

		Text label="Openweather" icon=sun {
		    Frame label="Local Weather Station" {
				Text item=localStationId
				Text item=localStationName
				Mapview item=localStationLocation
			}
			Frame label="Current local weather" {
				Text item=localLastMeasurement
				Text item=localCurrentCondition
				Image item=localCurrentConditionIcon
				Text item=localCurrentTemperature
				Text item=localCurrentPressure
				Text item=localCurrentHumidity
				Text item=localCurrentWindSpeed
				Text item=localCurrentWindDirection
				Text item=localCurrentCloudiness
				Text item=localCurrentRainVolume
				Text item=localCurrentSnowVolume
			}
			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
			}

and here are the items

//#########################################################
//# openweathermap

String localStationId "ID [%s]" { channel="openweathermap:weather-and-forecast:fc7917f9:station#id" }
String localStationName "Name [%s]" { channel="openweathermap:weather-and-forecast:fc7917f9:station#name" }
Location localStationLocation "Location [%2$s°N %3$s°E]" <location> { channel="openweathermap:weather-and-forecast:fc7917f9:station#location" }

DateTime localLastMeasurement "Timestamp of last measurement [%1$tY-%1$tm-%1$tdT%1$tH:%1$tM:%1$tS]" <time> { channel="openweathermap:weather-and-forecast:fc7917f9:current#time-stamp" }
String localCurrentCondition "Current condition [%s]" <sun_clouds> { channel="openweathermap:weather-and-forecast:fc7917f9:current#condition" }
Image localCurrentConditionIcon "Icon" { channel="openweathermap:weather-and-forecast:fc7917f9:current#icon" }
Number:Temperature localCurrentTemperature "Current temperature [%.1f %unit%]" <temperature> { channel="openweathermap:weather-and-forecast:fc7917f9:current#temperature" }
Number:Pressure localCurrentPressure "Current barometric pressure [%.1f %unit%]" <pressure> { channel="openweathermap:weather-and-forecast:fc7917f9:current#pressure" }
Number:Dimensionless localCurrentHumidity "Current atmospheric humidity [%d %unit%]" <humidity> { channel="openweathermap:weather-and-forecast:fc7917f9:current#humidity" }
Number:Speed localCurrentWindSpeed "Current wind speed [%.1f km/h]" <wind> { channel="openweathermap:weather-and-forecast:fc7917f9:current#wind-speed" }
Number localCurrentWind "Current wind speed [%.1f km/h]" 	{ channel="openweathermap:weather-and-forecast:fc7917f9:current#wind-speed" }
Number:Angle localCurrentWindDirection "Current wind direction [%d %unit%]" <wind> { channel="openweathermap:weather-and-forecast:fc7917f9:current#wind-direction" }
Number:Dimensionless localCurrentCloudiness "Current cloudiness [%d %unit%]" <clouds> { channel="openweathermap:weather-and-forecast:fc7917f9:current#cloudiness" }
Number:Length localCurrentRainVolume "Current rain volume [%.1f %unit%]" <rain> { channel="openweathermap:weather-and-forecast:fc7917f9:current#rain" }
Number:Length localCurrentSnowVolume "Current snow volume [%.1f %unit%]" <snow> { channel="openweathermap:weather-and-forecast:fc7917f9:current#snow" }

DateTime localDailyForecastTodayTimestamp "Timestamp of forecast [%1$tY-%1$tm-%1$td]" <time> { channel="openweathermap:weather-and-forecast:fc7917f9:forecastToday#time-stamp" }
String localDailyForecastTodayCondition "Condition for today [%s]" <sun_clouds> { channel="openweathermap:weather-and-forecast:fc7917f9:forecastToday#condition" }
Image localDailyForecastTodayConditionIcon "Icon" { channel="openweathermap:weather-and-forecast:fc7917f9:forecastToday#icon" }
Number:Temperature localDailyForecastTodayMinTemperature "Minimum temperature for today [%.1f %unit%]" <temperature> { channel="openweathermap:weather-and-forecast:fc7917f9:forecastToday#min-temperature" }
Number:Temperature localDailyForecastTodayMaxTemperature "Maximum temperature for today [%.1f %unit%]" <temperature> { channel="openweathermap:weather-and-forecast:fc7917f9:forecastToday#max-temperature" }
Number:Pressure localDailyForecastTodayPressure "Barometric pressure for today [%.1f %unit%]" <pressure> { channel="openweathermap:weather-and-forecast:fc7917f9:forecastToday#pressure" }
Number:Dimensionless localDailyForecastTodayHumidity "Atmospheric humidity for today [%d %unit%]" <humidity> { channel="openweathermap:weather-and-forecast:fc7917f9:forecastToday#humidity" }
Number:Speed localDailyForecastTodayWindSpeed "Wind speed for today [%.1f km/h]" <wind> { channel="openweathermap:weather-and-forecast:fc7917f9:forecastToday#wind-speed" }
Number:Angle localDailyForecastTodayWindDirection "Wind direction for today [%d %unit%]" <wind> { channel="openweathermap:weather-and-forecast:fc7917f9:forecastToday#wind-direction" }
Number:Dimensionless localDailyForecastTodaytCloudiness "Cloudiness for today [%d %unit%]" <clouds> { channel="openweathermap:weather-and-forecast:fc7917f9:forecastToday#cloudiness" }
Number:Length localDailyForecastTodayRainVolume "Rain volume for today [%.1f %unit%]" <rain> { channel="openweathermap:weather-and-forecast:fc7917f9:forecastToday#rain" }
Number:Length localDailyForecastTodaySnowVolume "Snow volume for today [%.1f %unit%]" <snow> { channel="openweathermap:weather-and-forecast:fc7917f9:forecastToday#snow" }

// UV Index
//DateTime localCurrentUVIndexTimestamp "Timestamp of last measurement [%1$tY-%1$tm-%1$td]" <time> { channel="openweathermap:uvindex:fc7917f9:current#timestamp" }
//Number localCurrentUVIndex "Current UV Index [%d]" { channel="openweathermap:uvindex:fc7917f9:current#uvindex" }
//DateTime localForecastTomorrowUVIndexTimestamp "Timestamp of forecast [%1$tY-%1$tm-%1$td]" <time> { channel="openweathermap:uvindex:fc7917f9:forecastTomorrow#timestamp" }
//Number localForecastTomorrowUVIndex "UV Index for tomorrow [%d]" { channel="openweathermap:uvindex:fc7917f9:forecastTomorrow#uvindex" }

Number owmUVIndex "UV Index [%.1f]" <uvindex> ["Wetter","UV-Index"] { channel="openweathermap:uvindex:39bf152d:local:current#uvindex" }
DateTime owmUVIndexLastChange "Last Change [%1$tY-%1$tm-%1$td]" <time> { channel="openweathermap:uvindex:39bf152d:local:current#time-stamp" }
Number owmUVIndexTomorrow "UV Index (Tomorrow) [%.1f]" <uvindex> { channel="openweathermap:uvindex:39bf152d:local:forecastTomorrow#uvindex" }
DateTime owmUVIndexLastChangeTomorrow "Forecast Date [%1$tY-%1$tm-%1$td]" <time> { channel="openweathermap:uvindex:39bf152d:local:forecastTomorrow#time-stamp" }
Number owmUVIndexDay2 "UV Index (in 2 days) [%.1f]" <uvindex> { channel="openweathermap:uvindex:39bf152d:local:forecastDay2#uvindex" }
DateTime owmUVIndexLastChangeDay2 "Forecast Date [%1$tY-%1$tm-%1$td]" <time> { channel="openweathermap:uvindex:39bf152d:local:forecastDay2#time-stamp" }
Number owmUVIndexDay3 "UV Index (in 3 days) [%.1f]" <uvindex> { channel="openweathermap:uvindex:39bf152d:local:forecastDay3#uvindex" }
DateTime owmUVIndexLastChangeDay3 "Forecast Date [%1$tY-%1$tm-%1$td]" <time> { channel="openweathermap:uvindex:39bf152d:local:forecastDay3#time-stamp" }

it is now the 6/1/19 10:26 AM and both the OWM and UV index parameters says its the 6/1/2019 so it seems to be a timezone issue, which only impacts the UV index ‘Last Change’ value.

Here is a log entry for the owmUVIndexLastChange

2019-01-06 10:41:45.556 [vent.ItemStateChangedEvent] - owmUVIndexLastChange changed from NULL to 2019-01-06T01:00:00.000+1300


Thanks

Paul

To enable TRACE logging do the following steps:

You maybe want to send it via PM to me to avoid leaking sensitive data.

Yes, that is my guess too. The documentation tells:

Please remember that data is provided only for 12:00 p.m.

Take a look at the icon being displayed, is that the image for night time? as I say in the post its 10:26 AM sun was nicely up and shining.

I have PM’d the trace logs to you.

Thanks

Paul

I would assume they calculate the day/night icons based on the location where the company behind OWM is located - which is London.

Ahh, so the binding is not choosing the icon, OWM is?
If they are indeed calculating the icon based on their servers location or TZ then they may also be screwing up the date stamp too.

I will stop displaying the icon then as it will cause more confusion and reduce the credibility rather than enhance in any meaningful way.

Thanks

Paul

Yes, that is true. The binding only downloads the suggested icon, caches and prepares it for displaying. I would suggest to switch to a manual calculated solution which considers your local sunrise/sunset to determine if it is day or night.

From what I have seen so far I understand the following:

  1. All date timestamps are held by OWM in UTC

  2. A local weather station will provide their data upstream in UTC form.

  3. A local client will retrieve the measurements and apply local timezone

If you are always looking for your own weather in your own timezone this will work well. The two issues we seem to be tripping over is that to understand the day locally you require both the date and the UTC time as depending on the tz offset the local day could be a day before or the day after the UTC one. Therefore the current approach of stripping the time from the UVIndex last change parameter causes issues.

Also a warning that this current approach will only work for grabbing the local weather or at least weather in the same timezone as your clients local time.

say I am in New Zealand, and I am interested in the weather locally, in UK where I have family. There is no easy way to acieve this with the current configuration. I think this is a binding constraint and needs to be called out in the docs.

Looking at the first issue which is more significant as everywhere will see the impact of this discrepancy and the further away from UTC the more noticeable it becomes, so L.A is pretty noticeable too I would think.

I see the image name is simple an image type followed by an n for night or a d for day. I would think the binding configuration could easily accommodate for this scheme and download the correct image based on the local timezone. It would get more complex if you wanted it in the local timezone of the requested measurement, but as one of the parameters returned is the country and the sunrise/sunset is also provided using these values in the binding to determine the image to grab would provide a universal outcome.

The bit that is tying me up in knots is when does the weather station provide the UVIndex measurement? is it every hour or what? as this time data is simply lost with the move to a UTC date that it was received.

If you are willing to knock up a test jar, I am willing to test it with you.

Regards

Paul

Thank you very much for your opinion on this topic.

May I ask you to write a short paragraph about that for the documentation? That would be appreciated.

I like the idea of calculating the icon. If we take into account the local sunrise / sunset timestamp - which is part of the data provided by OWM - to determine if it is day or night and combine it with the id of the current weather condition we can use the mapping described here to get the matching icon.

In my area sunset happened yesterday at 4:30 p.m., sunrise today was 8:30 a.m… The icon changed accordingly. Can you track it in your events.log?

2019-01-07 16:59:38.530 [vent.ItemStateChangedEvent] - openweathermap_weather_and_forecast_api_local_current_icon_id changed from 09d to 09n
2019-01-08 09:00:35.647 [vent.ItemStateChangedEvent] - openweathermap_weather_and_forecast_api_local_current_icon_id changed from 09n to 09d

The UV Index value will be updated only once per day. But to be honest I do not now the source of the data.

Sure no problem writing a paragraph for the docs, I will need to know what bit you would presented? How about I write something then you can review it and we can gain a direction from there.

I have added the CurrentIcon once again to my configuration as I had removed it as it was likely to cause confusion.

here is an extract from the eventlog when I thought the image was enabled, not looking similar to yours though.

  C:\Users\idkpm\AppData\Local\Temp\scp46189\var\log\openhab2\events.log.6 (8 hits)
	Line 76814: 2019-01-04 20:57:39.839 [.ItemChannelLinkAddedEvent] - Link 'localCurrentConditionIcon-openweathermap:weather-and-forecast:api:local:current#icon' has been added.
	Line 77769: 2019-01-04 21:15:57.803 [.ItemChannelLinkAddedEvent] - Link 'localCurrentConditionIcon-openweathermap:weather-and-forecast:39bf152d:local:current#icon' has been added.
	Line 77826: 2019-01-04 21:15:59.479 [vent.ItemStateChangedEvent] - localCurrentConditionIcon changed from NULL to raw type (image/png): 2859 bytes
	Line 78991: 2019-01-04 21:39:42.608 [vent.ItemStateChangedEvent] - localCurrentConditionIcon changed from raw type (image/png): 2859 bytes to raw type (image/png): 2817 bytes
	Line 105993: 2019-01-05 09:33:57.456 [.ItemChannelLinkAddedEvent] - Link 'localCurrentConditionIcon-openweathermap:weather-and-forecast:fc7917f9:local:current#icon' has been added.
	Line 110963: 2019-01-05 11:34:43.437 [.ItemChannelLinkAddedEvent] - Link 'localCurrentConditionIcon-openweathermap:weather-and-forecast:fc7917f9:current#icon' has been added.
	Line 116109: 2019-01-05 13:13:49.734 [vent.ItemStateChangedEvent] - localCurrentConditionIcon changed from raw type (image/png): 2817 bytes to raw type (image/png): 2859 bytes
	Line 140990: 2019-01-05 21:07:28.644 [vent.ItemStateChangedEvent] - localCurrentConditionIcon changed from raw type (image/png): 2859 bytes to raw type (image/png): 2817 bytes

Let me know if I need to filter on something specific I used 'localCurrentConditionIcon ’ which is the image item name.

Thanks

Paul

Hi,
I try to use the uvindex -Thing in my setup, but it doesn’t seem to work (can’t get any values).

I’m using OH 2.4.0.1 Release Build and ESH 0.10.0

openhab> feature:list | grep -i esh | grep -i started
esh.tp-base                                 (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x Eclipse SmartHome Target Platform Base
esh.tp-commons-net                          (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x The Apache Commons Net library
esh.tp-jax-rs                               (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh.tp-jax-rs-min                           (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh.tp-kat.cpy-jersey-min-2.22.2            (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh.tp-jupnp                                (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x UPnP/DLNA library for Java
esh.tp-jmdns                                (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x An implementation of multi-cast DNS in Java.
esh.tp-lsp4j                                (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x Eclipse LSP4J
esh.tp-xtext                                (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x Xtext - Language Engineering Made Easy
esh.tp-xtext-ide                            (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x Xtext - IDE Support
esh-base                                    (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x ESH
esh-auth-oauth2client                       (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-io-console-karaf                        (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x Karaf Console support for SmartHome stuff
esh-io-rest-sitemap                         (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-io-rest-voice                           (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-io-rest-mdns                            (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-io-transport-mdns                       (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-io-transport-upnp                       (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-core                              (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-item                              (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-item-runtime                      (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-item-ide                          (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-persistence                       (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-persistence-runtime               (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-persistence-ide                   (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-rule                              (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-rule-runtime                      (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-rule-ide                          (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-script                            (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-script-runtime                    (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-script-ide                        (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-sitemap                           (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-sitemap-runtime                   (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-sitemap-ide                       (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-thing                             (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-thing-runtime                     (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-thing-ide                         (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-model-lsp                               (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-storage-json                            (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-ui                                      (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-ui-icon                                 (0x 0.10.0.oh240     x          x Started     x distro-2.4.0                x
esh-binding-astro                           (0x 0.10.0.oh240     x          x Started     x openhab-addons-2.4.0        x
esh-binding-ntp                             (0x 0.10.0.oh240     x          x Started     x openhab-addons-2.4.0        x
esh-binding-openweathermap                  (0x 0.10.0.oh240     x          x Started     x openhab-addons-2.4.0        x
esh-binding-sonos                           (0x 0.10.0.oh240     x          x Started     x openhab-addons-2.4.0        x
esh-transform-exec                          (0x 0.10.0.oh240     x          x Started     x openhab-addons-2.4.0        x Exec Transformation
esh-transform-javascript                    (0x 0.10.0.oh240     x          x Started     x openhab-addons-2.4.0        x Javascript Transformation
esh-transform-jsonpath                      (0x 0.10.0.oh240     x          x Started     x openhab-addons-2.4.0        x JSONPath Transformation
esh-transform-map                           (0x 0.10.0.oh240     x          x Started     x openhab-addons-2.4.0        x Map Transformation
esh-transform-regex                         (0x 0.10.0.oh240     x          x Started     x openhab-addons-2.4.0        x RegEx Transformation
esh-transform-scale                         (0x 0.10.0.oh240     x          x Started     x openhab-addons-2.4.0        x Scale Transformation
esh-ui-basic                                (0x 0.10.0.oh240     x          x Started     x openhab-addons-2.4.0        x
esh-ui-paper                                (0x 0.10.0.oh240     x          x Started     x openhab-addons-2.4.0        x
openhab>

My .things - File is

Bridge openweathermap:weather-api:api "OpenWeatherMap Account" [apikey="my-key1-32", refreshInterval=30, language="de"] {
     Thing weather-and-forecast local "Local Weather And Forecast" [location="xx.xxxxxx,y.yyyyyyy,zzz", forecastHours=120, forecastDays=0]
     Thing uvindex local "Local UV Index" [location="xx.xxxxxx,y.yyyyyyy", forecastDays=7]
}

.items -File

DateTime             localCurrentUVIndexTimestamp            "Timestamp of last measurement [%1$tY-%1$tm-%1$td]"           <time>         (gOWM,gOWMOutlook)  { channel="openweathermap:uvindex:api:local:current#timestamp" }
Number               localCurrentUVIndex                     "Current UV Index [%d]"                                                      (gOWM,gOWMOutlook)  { channel="openweathermap:uvindex:api:local:current#uvindex" }
String               localCurrentDummy                       "---------------------------------------"                     <clouds>       (gOWM)

and the result is:

Has anyone an idea what i missed ?

Thanks in advance for help
Peter

Hi Peter,

Do you use the OH2.4 binding version or did you download the linked .jar file? The UV Index enhancement is not part of OH2.4 release build.

Hello Christoph,thx for reply.
I’m using the Version which comes up with OH2.4, didn’t install any .jar file.

In the meantime i made a workaround within the http.cfg to get the current UV-Index and this works quite fine.

Do you think that it will be part of the next Milestone?

Yes, of course it will.

1 Like

I have searched in my event.log and found no way to determine the image being retrieved.
In the openhab log I filter for the term ‘icon’,the local
sunrise 6:02 AM
sunset 8:54 PM

the change from d to n makes no sense see the log entries below:

It looks like the d icon was present until 04:00 AM and then it went to Night
two hours later at 6:0 AM it really is daylight and the icon is wrong again.

2019-01-14 03:58:29.431 [TRACE] [.connection.OpenWeatherMapConnection] - OpenWeatherMap response: status = 200, content = '{"cod":"200","message":0.0046,"cnt":8,"list":[{"dt":1547391600,"main":{"temp":16.74,"temp_min":16.74,"temp_max":17.06,"pressure":1012.18,"sea_level":1016.55,"grnd_level":1012.18,"humidity":95,"temp_kf":-0.32},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":32},"wind":{"speed":7.41,"deg":314.503},"rain":{"3h":0.07},"sys":{"pod":"n"},"dt_txt":"2019-01-13 15:00:00"},{"dt":1547402400,"main":{"temp":14.74,"temp_min":14.74,"temp_max":14.98,"pressure":1015.27,"sea_level":1019.36,"grnd_level":1015.27,"humidity":100,"temp_kf":-0.24},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":76},"wind":{"speed":7.91,"deg":188.503},"rain":{"3h":0.065},"sys":{"pod":"d"},"dt_txt":"2019-01-13 18:00:00"},{"dt":1547413200,"main":{"temp":14.97,"temp_min":14.97,"temp_max":15.13,"pressure":1016.35,"sea_level":10...
2019-01-14 03:58:29.449 [DEBUG] [nWeatherMapWeatherAndForecastHandler] - Update channel 'icon' of group 'current' with new state 'raw type (image/png): 2565 bytes'.
2019-01-14 04:08:31.623 [TRACE] [.connection.OpenWeatherMapConnection] - OpenWeatherMap response: status = 200, content = '{"coord":{"lon":174.82,"lat":-41.23},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"base":"stations","main":{"temp":16,"pressure":1003,"humidity":87,"temp_min":16,"temp_max":16},"visibility":10000,"wind":{"speed":5.7,"deg":20},"clouds":{"all":32},"dt":1547389800,"sys":{"type":1,"id":7358,"message":0.0049,"country":"NZ","sunrise":1547312601,"sunset":1547366093},"id":2186131,"name":"Ngauranga","cod":200}'

any progress on the test jar?

Thanks

Paul