Announcing OpenWeatherMap binding for Eclipse SmartHome / openHAB

Hi Leif,

I am not sure what is the exact reason why your examples are not working. I use it in this way - which works quite nice:

Number:Angle owmWindDegree "Windrichtung [%d %unit%]" <wind> { channel="openweathermap:weather:api:local:current#wind-direction" }

In the sitemap:

Frame label="Windrichtung" {
    Text item=owmWindDegree label="Windrichtung [SCALE(windDirection.scale):%s]"
    Text item=owmWindDegree
}

Why? I do not think we need an item containing the transformed value. The transformation is important for us in the moment we want to find out the current wind direction and thus I apply it only in the sitemap.

That´s it. I´ve moved the transformation from the item to the sitemap. Now it´s working really well. Thank´s a lot.

if anyone needs this to translate in his own language, here you go:

String	owmCurrentCondition		"Weather Conditions [MAP(conditions.map):%s]"	<sun_clouds>	{ channel="openweathermap:weather:api:local:current#condition-id" }

conditions.map

200=thunderstorm with light rain
201=thunderstorm with rain
202=thunderstorm with heavy rain
210=light thunderstorm
211=thunderstorm
212=heavy thunderstorm
221=ragged thunderstorm
230=thunderstorm with light drizzle
231=thunderstorm with drizzle
232=thunderstorm with heavy drizzle
300=light intensity drizzle
301=drizzle
302=heavy intensity drizzle
310=light intensity drizzle rain
311=drizzle rain
312=heavy intensity drizzle rain
313=shower rain and drizzle
314=heavy shower rain and drizzle
321=shower drizzle
500=light rain
501=moderate rain
502=heavy intensity rain
503=very heavy rain
504=extreme rain
511=freezing rain
520=light intensity shower rain
521=shower rain
522=heavy intensity shower rain
531=ragged shower rain
600=light snow
601=snow
602=heavy snow
611=sleet
612=shower sleet
615=light rain and snow
616=rain and snow
620=light shower snow
621=shower snow
622=heavy shower snow
701=mist
711=smoke
721=haze
731=sand, dust whirls
741=fog
751=sand
761=dust
762=volcanic ash
771=squalls
781=tornado
800=clear sky
801=few clouds
802=scattered clouds
803=broken clouds
804=overcast clouds

conditions_nl.map

200=onweer met lichte regen
201=onweer met regen
202=onweer met zware regenval
210=lichte onweersbui
211=onweer
212=zwaar onweer
221=haveloze onweersbui
230=onweer met lichte motregen
231=onweer met motregen
232=onweer met zware motregen
300=lichtintensiteit motregen
301=motregen
302=zware motregen
310=lichte regenval
311=motregen
312=zware regenval
313=regen en motregen
314=zware regenbuien en motregen
321=motregen
500=lichte regen
501=matige regen
502=regen met hevige intensiteit
503=zeer zware regen
504=extreme regen
511=ijzel
520=regenbui met lichte intensiteit
521=regen
522=zware regenbuien
531=rafelige regen in de sneeuw
600=lichte sneeuw
601=sneeuw
602=zware sneeuwval
611=natte sneeuw
612=regen-ijzel
615=lichte regen en sneeuw
616=regen en sneeuw
620=lichte natte sneeuw
621=natte sneeuw
622=zware natte sneeuw
701=mist
711=rook
721=nevel
731=zand, stof wervelt
741=mist
751=zand
761=stof
762=vulkaanas
771=rukwinden
781=tornado
800=heldere lucht
801=weinig bewolking
802=losse wolken
803=gebroken wolken
804=bewolkte wolken
1 Like

Is this still under development or can it be used safely in long run environments ? As I can only find testversions like here: https://github.com/cweitkamp/smarthome/commit/b649ac809cdddb61dcd86f3af04db48c1ec81569#commitcomment-30297201

Dear Raymond,

Yes, it is still in development. I am working on the final version this week.

Breaking news.

First code review has passed and with it a great redesign of things for current weather and forecast was introduced. Unfortunately the current structure of the things had to be changed. Now they are combined into a new single thing. Good news are: Now you are able to configure the number of forecast hours and / or days on your own - no limitations - except the API bound restrictions.

You can download a new Testversion here (requires ESH build 306 or higher and / or OH2.4.M5 milestone 5 / or OH2.4 build 1405 or higher). Older versions (e.g. for OH2.3 release) are not supported anymore. I have updated the marketplace version too.

Major changes:

  • Attention: Added single thing weather-and-forecast for weather and forecast - combines all three previous available things
    Fair warning: The things weather, hourly-forecast and daily-forecast will be removed in the final version
  • Added dynamic number of hours / days for forecast - you now can change the number of forcasted hours / days in the thing configuration
    – hourly forecast is now supported from 3h up to 120h instead of 24h (24h are default)
    – daily forecast is now supported from 0 days up to 16 days instead of 5 days (5 days are default)
  • Finalized documentation
  • Finalized German translations - more translations in other languages are welcome; please PM me if you like to help
  • Introduced dedicated channel-types for forcasted data and removed icon-id channel
  • Removed discovery of the OpenWeatherMap Account - you now have to add it manually
  • Code improvements and stability

Thanks you very much for feedback.

Best,

Christoph

3 Likes

Hi Christoph.
I can’t get the binding running. Yesterday i moved to milestone M5 and nothing changed. Before i used the stable version.
Do i need the things.file or can i configure it by paper UI.
If i use your thingdemo.file i get the error missing EOT at : line1,22.
Can you help me,
thanks and greetings,
Markus

Hi Markus,

What a pitty. The example for demo.things from the latest documentation is broken. bridge has to start with a capital letter: Bridge. Thank you very much for reporting this.

Here is a fixed version:

Bridge openweathermap:weather-api:api "OpenWeatherMap Account" [apikey="AAA", refreshInterval=30, language="de"] {
    Thing weather-and-forecast local "Local Weather And Forecast" [location="XXX,YYY", forecastHours=0, forecastDays=7]
    Thing weather-and-forecast miami "Weather And Forecast In Miami" [location="25.782403,-80.264563", forecastHours=24, forecastDays=0]
}
1 Like

@cweitkamp
how long do I wait till I some my site up weather working?

2018-11-03 00:06:09.290 [WARN ] [.weather.internal.bus.WeatherBinding] - Unable to find any configuration settings for weather binding. Check openhab.cfg.

2018-11-03 00:06:09.294 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler, id=401, bundle=242/mvn:org.openhab.binding/org.openhab.binding.weather/1.13.0-SNAPSHOT]: Updating property weather of configuration org.openhab.weather caused a problem: Unable to find any configuration settings for weather binding. Check openhab.cfg.

org.osgi.service.cm.ConfigurationException: weather : Unable to find any configuration settings for weather binding. Check openhab.cfg.

	at org.openhab.binding.weather.internal.bus.WeatherBinding.updated(WeatherBinding.java:76) ~[?:?]

	at org.apache.felix.cm.impl.helper.ManagedServiceTracker$1.run(ManagedServiceTracker.java:177) ~[9:org.apache.felix.configadmin:1.9.4]

	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]

	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:173) ~[9:org.apache.felix.configadmin:1.9.4]

	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152) [9:org.apache.felix.configadmin:1.9.4]

	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85) [9:org.apache.felix.configadmin:1.9.4]

	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1102) [9:org.apache.felix.configadmin:1.9.4]

	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1058) [9:org.apache.felix.configadmin:1.9.4]

	at org.apache.felix.cm.impl.UpdateThread$1.run(UpdateThread.java:126) [9:org.apache.felix.configadmin:1.9.4]

	at org.apache.felix.cm.impl.UpdateThread$1.run(UpdateThread.java:123) [9:org.apache.felix.configadmin:1.9.4]

	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]

	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:122) [9:org.apache.felix.configadmin:1.9.4]

	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105) [9:org.apache.felix.configadmin:1.9.4]

	at java.lang.Thread.run(Thread.java:748) [?:?]

==> /var/log/openhab2/events.log <==

2018-11-03 00:06:09.422 [thome.event.ExtensionEvent] - Extension 'binding-weather1' has been installed.```

Hi @adtwomey,

After installing the binding you have to create a bridge thing and put your credentials of your OWM account into its configuration. Afterwards the weather and forecast thing will be discovered automatically after a few seconds.

The log you have posted here is not related to the OWM binding. It shows messages for the OH1 weather binding.

So it’s not supported on a stable release of OH? I’ll wait for OH2.4 to become stable. :frowning:

I’m testing out the new Test Version. Got it installed and running, however unless I have 0 forecast days in the Bridge, it goes to Offline. Change it back to 1 through 5 it goes Offline. Change it back to 0 then it goes back online. I’ve currently got 3 hours set.

It’s my understanding that even though I’ve got the Free API account… I should still have access to up 5 days of forecast. Am I wrong?

No, not yet. If you are using only stable versions you have to wait until next release.

Yes, I am afraid you misunderstood it. The hourly forecast is available for everyone. From 3 hours up to 120 hours (which are 5 days). The daily forecast is only available for paid accounts (see their Price-list).

what will this Icon do? I do see it in there

That’s a lots of work you saved me :smiley:

1 Like

It is already implemented and shows an icon of the weather condition (e.g. range of thunderstorm, drizzle, rain, snow, clouds, atmosphere including extreme conditions like tornado, hurricane etc.)

1 Like

It is done. The PR has been merged and the binding will be part of an upcoming snapshot and of course in OH2.4 release. The Eclipse IoT Marketplace will be erased soon, I recommend you to switch to final version now.

Roadmap

  • [ ] Add configuration for cityId instead of geographic coordinates
  • [ ] Add channels and trigger for sunrise and sunset
  • [ ] Add UV Index API
  • [ ] Store / cache icon file in a local folder

More feature requests are appreciated.

Thank you very much for your support.

Best,

Christoph

5 Likes

@cweitkamp Great news! Thanks for this binding, and just in time before WU goes away!!

How many API calls does the binding make whenever the forecast is refreshed? I’ll be running the binding on 3 systems, and I want to back into the smallest refresh interval that will keep me under the free limit.

Also, in the README, the hourly channel group IDs in the 3-Hour Forecast table shows this.

forecastHours03, forecastHours06, ... forecastHours120

Shouldn’t it be this?

forecastHours03, forecastHours06, ... forecastHours12

Or, possibly even this, since the 3-hour forecast can go all the way to 24 hours?

forecastHours03, forecastHours06, ... forecastHours24

The binding will perform up to 3 requests (one for each: current, hourly forecast, daily forecast) per refresh period. If you do not use e.g. the daily forecast the binding calls the OWM API only twice.

The hourly forecast can retrieve data for a maximum of five days in 3-hour steps (see 5 day weather forecast - OpenWeatherMap).

5 * 24 = 120 :wink:

Thanks. I understand now. The 3-hour steps are over the full 5 days.

So there’s really no easy way to come up with a daily forecast from the 3-hour steps… And, $40 USD / month is crazy expensive for the daily forecast. :frowning: