Announcing OpenWeatherMap binding for Eclipse SmartHome / openHAB

A new weather binding for ESH / OH2 is in the pipe. You can add it to your system via the Eclipse IoT Marketplace or manually. Requires OH2 2.3+ (see post 116).

The binding supports current weather, 5 day / 3 hour forecast (currently for 24h) and 16 day / daily forecast (currently for 5 days / paid accounts).

Have a look at the documentation finalized documentation.

I need a lot of volunteers for testing. Any kind of feedback will be very much appreciated.

22 Likes

Tips & Tricks

Roadmap

  • Add configuration for cityId instead of geographic coordinates
  • Add UV Index API
  • Store / cache icon file in a local folder
  • Add channel for gust-speed
  • Add configuration for number of forecasted hours / days
  • Refactor polling job strategy
    • Deactivate polling job if no thing is configured
    • Activate polling job if first thing has been added
    • Refresh immediately if a new thing has been added

New features

Scale transformation for wind speed expressed in Beaufort scala

Scale transformation for wind direction

Hi Christoph,
Looks good,
Could you change the items examples to English, please?
I’ll do some testing over the week-end

:+1:

Are you sure about the two text-parts for different forecasts in your post? (your first string/link:

correponds with the data from OWM, the second however:

is named “16 days/daily forecast” by OWM)

Looks great. I will take a look and see how it works. Thanks for the work.

@vzorglub Yes, of course. The documentation status is in progress. I guess I have to add a lot more information to it.

@opus Thanks for reading carefully. I have changed the description of the second link in my initial post.

2 Likes

@vzorglub can you let me know if you get something setup? This might work for me also. Love to see an example in english

@Thedannymullen
I had signed up for openWeathermap a long time ago and forgot about it.
I logged in and my api key was there.

Installed the binding from the market place
Bridge thing appeared and I put the API key - Online straight away
2 more things appear - Local weather and 3 hour forecast
I createad an item in PAperUI for the current temperature and I have a value
I will compare with the current weather provider I am using (DarkSky) I don’t think their current weather is vary good but I like their forecasts so I may end up using openweathermap binding for the current conditions and darksky for the forecasts only.

1 Like

@vzorglub @Thedannymullen a preview for the English examples:

demo.items

DateTime owmLastMeasurement "Timestamp of last measurement [%1$tY-%1$tm-%1$tdT%1$tH:%1$tM:%1$tS]" <time> { channel="openweathermap:weather:api:local:current#time-stamp" }
String owmCurrentCondition "Current condition [%s]" <sun_clouds> { channel="openweathermap:weather:api:local:current#condition" }
Number:Temperature owmCurrentTemperature "Current temperature [%.1f %unit%]" <temperature> { channel="openweathermap:weather:api:local:current#temperature" }
Number:Temperature owmCurrentMinTemperature "Minimum temperature of today [%.1f %unit%]" <temperature> { channel="openweathermap:daily-openweathermap:weather:api:local:current#min-temperature" }
Number:Temperature owmCurrentMaxTemperature "Maximum temperature of today [%.1f %unit%]" <temperature> { channel="openweathermap:daily-openweathermap:weather:api:local:current#max-temperature" }
Number:Pressure owmCurrentPressure "Current barometric pressure [%.1f %unit%]" <pressure> { channel="openweathermap:weather:api:local:current#pressure" }
Number:Dimensionless owmCurrentHumidity "Current atmospheric humidity [%d %unit%]" <humidity> { channel="openweathermap:weather:api:local:current#humidity" }
Number:Speed owmCurrentWindSpeed "Current wind speed [%.1f km/h]" <wind> { channel="openweathermap:weather:api:local:current#wind-speed" }
Number:Angle owmCurrentWindDirection "Current wind direction [%d %unit%]" <wind> { channel="openweathermap:weather:api:local:current#wind-direction" }
Number:Dimensionless owmCurrentCloudiness "Current cloudiness [%d %unit%]" <clouds> { channel="openweathermap:weather:api:local:current#cloudiness" }
Number:Length owmCurrentRainVolume "Current rain volume [%.1f %unit%]" <rain> { channel="openweathermap:weather:api:local:current#rain" }
Number:Length owmCurrentSnowVolume "Current rain volume [%.1f %unit%]" <snow> { channel="openweathermap:weather:api:local:current#snow" }

DateTime owmForecastTodayTimestamp "Timestamp of forecast [%1$tY-%1$tm-%1$tdT%1$tH:%1$tM:%1$tS]" <time> { channel="openweathermap:daily-forecast:api:local:forecastToday#time-stamp" }
String owmForecastTodayCondition "Condition for today [%s]" <sun_clouds> { channel="openweathermap:daily-forecast:api:local:forecastToday#condition" }
Number:Temperature owmForecastTodayMinTemperature "Minimum temperature for today [%.1f %unit%]" <temperature> { channel="openweathermap:daily-forecast:api:local:forecastToday#min-temperature" }
Number:Temperature owmForecastTodayMaxTemperature "Maximum temperature for today [%.1f %unit%]" <temperature> { channel="openweathermap:daily-forecast:api:local:forecastToday#max-temperature" }
Number:Pressure owmForecastTodayPressure "Barometric pressure for today [%.1f %unit%]" <pressure> { channel="openweathermap:daily-forecast:api:local:forecastToday#pressure" }
Number:Dimensionless owmForecastTodayHumidity "Atmospheric humidity for today [%d %unit%]" <humidity> { channel="openweathermap:daily-forecast:api:local:forecastToday#humidity" }
Number:Speed owmForecastTodayWindSpeed "Wind speed for today [%.1f km/h]" <wind> { channel="openweathermap:daily-forecast:api:local:forecastToday#wind-speed" }
Number:Angle owmForecastTodayWindDirection "Wind direction for today [%d %unit%]" <wind> { channel="openweathermap:daily-forecast:api:local:forecastToday#wind-direction" }
Number:Dimensionless owmForecastTodaytCloudiness "Cloudiness for today [%d %unit%]" <clouds> { channel="openweathermap:daily-forecast:api:local:forecastToday#cloudiness" }
Number:Length owmForecastTodayRainVolume "Rain volume for today [%.1f %unit%]" <rain> { channel="openweathermap:daily-forecast:api:local:forecastToday#rain" }
Number:Length owmForecastTodaySnowVolume "Snow volume for today [%.1f %unit%]" <snow> { channel="openweathermap:daily-forecast:api:local:forecastToday#snow" }

String owmForecastTomorrowCondition "Condition for tomorrow [%s]" <sun_clouds> { channel="openweathermap:daily-forecast:api:local:forecastTomorrow#condition" }
Number:Temperature owmForecastTomorrowMinTemperature "Minimum temperature for tomorrow [%.1f %unit%]" <temperature> { channel="openweathermap:daily-forecast:api:local:forecastTomorrow#min-temperature" }
Number:Temperature owmForecastTomorrowMaxTemperature "Maximum temperature for tomorrow [%.1f %unit%]" <temperature> { channel="openweathermap:daily-forecast:api:local:forecastTomorrow#max-temperature" }
...

String owmForecastDay2Condition "Condition in 2 days [%s]" <sun_clouds> { channel="openweathermap:daily-forecast:api:local:forecastDay2#condition" }
Number:Temperature owmForecastDay2MinTemperature "Minimum temperature in 2 days [%.1f %unit%]" <temperature> { channel="openweathermap:daily-forecast:api:local:forecastDay2#min-temperature" }
Number:Temperature owmForecastDay2MaxTemperature "Maximum temperature in 2 days [%.1f %unit%]" <temperature> { channel="openweathermap:daily-forecast:api:local:forecastDay2#max-temperature" }
...

String owmCurrentConditionMiami "Current condition in Miami [%s]" <sun_clouds> { channel="openweathermap:weather:api:miami:current#condition" }
Number:Temperature owmCurrentTemperatureMiami "Current temperature in Miami [%.1f %unit%]" <temperature> { channel="openweathermap:weather:api:miami:current#temperature" }
...

demo.sitemap

sitemap demo label="OpenWeatherMap" {
    Frame label="Local weather" {
        Text item=owmLastMeasurement
        Text item=owmCurrentCondition
        Text item=owmCurrentTemperature
        Text item=owmCurrentMinTemperature
        Text item=owmCurrentMaxTemperature
        Text item=owmCurrentPressure
        Text item=owmCurrentHumidity
        Text item=owmCurrentWindSpeed
        Text item=owmCurrentWindDirection
        Text item=owmCurrentCloudiness
        Text item=owmCurrentRainVolume
        Text item=owmCurrentSnowVolume
    }
    Frame label="Forecast for today" {
        Text item=owmForecastTodayTimestamp
        Text item=owmForecastTodayCondition
        Text item=owmForecastTodayMinTemperature
        Text item=owmForecastTodayMaxTemperature
        Text item=owmForecastTodayPressure
        Text item=owmForecastTodayHumidity
        Text item=owmForecastTodayWindSpeed
        Text item=owmForecastTodayWindDirection
        Text item=owmForecastTodayCloudiness
        Text item=owmForecastTodayRainVolume
        Text item=owmForecastTodaySnowVolume
    }
    Frame label="Forecast for tomorrow" {
        Text item=owmForecastTomorrowCondition
        Text item=owmForecastTomorrowMinTemperature
        Text item=owmForecastTomorrowMaxTemperature
        ...
    }
    Frame label="Forecast in 2 days" {
        Text item=owmForecastDay2Condition
        Text item=owmForecastDay2MinTemperature
        Text item=owmForecastDay2MaxTemperature
        ...
    }
    Frame label="Weather in Miami" {
        Text item=owmCurrentConditionMiami
        Text item=owmCurrentTemperatureMiami
        ...
    }
}
1 Like

Looks good, just one left behind

Frame label="Weather in Miami" {

I have changed it. Thanks.

Thanks @vzorglub and @cweitkamp. I am still trying to connect to google, before I even worry about weather…

Thanks a lot for that binding. :+1:

I think I’ve found one issue, though: I’ve set the refresh interval to 10 minutes, but still do only get values every 60 minutes:

2018-06-17 10:43:52.746 [vent.ItemStateChangedEvent] - owmCurrentWind changed from 5.1 m/s to 5.7 m/s
2018-06-17 11:43:58.611 [vent.ItemStateChangedEvent] - owmCurrentWind changed from 5.7 m/s to 5.1 m/s
2018-06-17 12:44:01.313 [vent.ItemStateChangedEvent] - owmCurrentWind changed from 5.1 m/s to 5.7 m/s
2018-06-17 13:44:04.043 [vent.ItemStateChangedEvent] - owmCurrentWind changed from 5.7 m/s to 5.1 m/s
2018-06-17 14:44:07.044 [vent.ItemStateChangedEvent] - owmCurrentWind changed from 5.1 m/s to 4.6 m/s
2018-06-17 15:44:11.814 [vent.ItemStateChangedEvent] - owmCurrentWind changed from 4.6 m/s to 5.1 m/s

Thing is set via PaperUI:

  "openweathermap:weather-api:api": {
    "class": "org.eclipse.smarthome.core.thing.internal.BridgeImpl",
    "value": {
      "label": "OpenWeatherMap API",
      "channels": [],
      "configuration": {
        "properties": {
          "apikey": "yxyxyxyxyxyxyxyx",
          "refreshInterval": 10,
          "language": "de",
          "hourlyForecast": true,
          "dailyForecast": false
        }

@sihui Thanks for the feedback. I am happy that it works for you.

Can you please watch the time-stamp channel in the same way? Or enable DEBUG logging to track the requests? I have the slight feeling that the data of OWM itself is refreshed only once - maybe twice - per hour.

I already did :grinning:

2018-06-17 10:13:50.735 [vent.ItemStateChangedEvent] - owmCurrentTime changed from 2018-06-17T09:20:00.000+0200 to 2018-06-17T09:37:00.000+0200
2018-06-17 10:43:52.728 [vent.ItemStateChangedEvent] - owmCurrentTime changed from 2018-06-17T09:37:00.000+0200 to 2018-06-17T10:20:00.000+0200
2018-06-17 11:43:58.603 [vent.ItemStateChangedEvent] - owmCurrentTime changed from 2018-06-17T10:20:00.000+0200 to 2018-06-17T11:20:00.000+0200
2018-06-17 12:44:01.309 [vent.ItemStateChangedEvent] - owmCurrentTime changed from 2018-06-17T11:20:00.000+0200 to 2018-06-17T12:20:00.000+0200
2018-06-17 13:44:04.027 [vent.ItemStateChangedEvent] - owmCurrentTime changed from 2018-06-17T12:20:00.000+0200 to 2018-06-17T13:20:00.000+0200
2018-06-17 14:44:07.040 [vent.ItemStateChangedEvent] - owmCurrentTime changed from 2018-06-17T13:20:00.000+0200 to 2018-06-17T14:20:00.000+0200
2018-06-17 15:44:11.811 [vent.ItemStateChangedEvent] - owmCurrentTime changed from 2018-06-17T14:20:00.000+0200 to 2018-06-17T15:20:00.000+0200

Quick question, what binding name do I need to put in the addons.cfg, please?

market = binding-4126092

Is that the whole string: “market=binding-4126092” or just “binding-4126092”

Thanks

Did not try it myself, I was just referring to that post I’ve found.
But it looks like it is the whole string :sunglasses:

Got it.Had to add another line to the file just for market binding. Working.
Thanks

1 Like