Announcing OpenWeatherMap binding for Eclipse SmartHome / openHAB

Tags: #<Tag:0x00007f174eb7d6c8> #<Tag:0x00007f174eb7d5b0>

:+1: Great. I thought about too. But to heavy for me.I’m newbie and in my former live i was an accountant (i only know “Excel” and a bit of ERP-Software). So i think it’s not that easy as it seems, as the daily time sections are sliding.:wink:

No, I will not do a research for such a solution inside the binding because bindings are meant to transfer and prepare data from a specific API towards the framework. They should not contain business logic. Therefore we have other tools like groups, rules or transformations. Maybe powerful profiles in the future.

If I should make a proposal I would say create some groups, use the power of the group arithmetical functions (MIN,MAX,AVG), and stuff all items of the hourly forecast into them. Easy without much effort.

For other edge cases you can use rules or transformations.

Sorry, I was just kidding about that. :sunglasses:

It just was an idea of me and i understand the aspects that drives you when developing a binding.
I hope the time will come, when i can handle the binding better. And then i will thinking about tunings.:wink:

hi Christoph,

thanks for the binding.

Unless I’ve misunderstood, are you saying that the binding doesn’t support the 5-day forecast?

I’m slightly confused, as the api will return the 5-day forecast, eg:-,uk

Hello guys,

I´d like to merge the items winddirection an windspeed into one item. What I did is:

String Wind_Geschw_und_Richtung
Number Windrichtung { channel="openweathermap:weather-and-forecast:9ee44fae:local:current#wind-direction" }
Number Windgeschwindigkeit { channel="openweathermap:weather-and-forecast:9ee44fae:local:current#wind-speed" }
rule "Windgeschwindigkeit und Richtung"
  Item Windgeschwindigkeit changed or
  Item Windrichtung changed
  var Number wg = (((Windgeschwindigkeit.state as DecimalType).floatValue)*3.6)
  var wr = transform("SCALE", "wind.scale",Windrichtung.state.toString)

  var String Ausgabe = String::format("%1$.0f km/h aus " +wr, wg)

(thx to M. Spiller for that)

That is working quite well. But I had to create those two items “Windgeschwindigkeit” und “Windrichtung”. Instead I would like to use the two items from the demo.items that I already have:

Number:Speed localCurrentWindSpeed "Current wind speed [%.1f km/h]" <wind> { channel="openweathermap:weather-and-forecast:9ee44fae:local:current#wind-speed" }
Number:Angle localCurrentWindDirection "Current wind direction [%d %unit%]" <wind> { channel="openweathermap:weather-and-forecast:9ee44fae:local:current#wind-direction" }

Those two items won´t work with my rule because of the additions “Speed” and “Angle” respectively. How do I have to change my rule so I can get rid of those two extra items?

Thanks a lot.

1 Like

I quoted my opening post. The current weather and the 5 days forecast (in 3 hour steps) are available for everyone. The 16 days forecast (in daily intervals) is restricted to users owning a paid account (Startup minimum). The weather-and-forecast Thing provided by the bindings has different channel groups. One for current weather, a user-defined number (between 0 and 120 in 3 hour steps) of hourly forecast channel groups and a user-defined number (between 0 and 16 in 1 day steps) of dayly forecast channel groups. The daily forecast channel groups are removed automatically if the configured key belongs to an unpaid account.

To answer your question directly: The binding supports the 5 days forecast. But only in 3 hour steps unless you own a non-free account.

1 Like

just fyi: I am going to get a cool HABPanel widget going for this… more news soon :slight_smile:

Hi Leif,

from my point of view it can be done in this way. Please be aware of typos I wrote this down in a second:

rule "Windgeschwindigkeit und Richtung"
    Item localCurrentWindSpeed changed or
    Item localCurrentWindDirection changed
    Wind_Geschw_und_Richtung.postUpdate((localCurrentWindSpeed.state as QuantityType<Speed>).toString + " aus " + transform("SCALE", "wind.scale", localCurrentWindDirection.state.toString))
1 Like

Thats it. I´ve changed the then-part to:

  Wind_Geschw_und_Richtung.postUpdate((localCurrentWindSpeed.getStateAs(QuantityType).toString) + " aus " + transform("SCALE", "wind.scale", (localCurrentWindDirection.state as QuantityType<Number>).doubleValue.toString))

Otherwise VSC displayed an error saying that “Speed cannot be resolved to a type” and scale said: “Could not transform ‘60.0 °’ with the file ‘wind.scale’ : Scale can only be used with numeric inputs”.

Now it´s working fine and I won´t need my additional “dimensionless” items any more. Thank you very much for leading me to the right direction.

Best regards


ahh, thank you. I’ve set the forecast hours to 120, and am now getting all the forecasts. :slight_smile:

I’m interested in this binding, but is not present in my Paper UI bindings section. I’ve a standard openHab 2.3 installation.

How can I install it ?


You will need to upgrade openHAB to the M6 release:
Follow the instructions here:

Choose the Testing Release Option

I’am testing this Binding but have a refresh issue karaf console says I’am using of the Eclipse SmartHome OpenWeatherMap Binding.

I first added outdoor temperature using the example from the demo.items.
The value was filled. but isn’t being updated (refresh interval is 10 minutes).
I also added timestamp of last measurement. the log states the items file is successfully renewed but there’s no value getting retrieved.

The value is only updated if it changes.

@vzorglub that seems logical but the current temperature value hasn’t been updated in 5 hours.
When I just looked again I saw this error which happened a few minutes ago.

2018-11-29 20:09:58.081 [hingStatusInfoChangedEvent] - 'openweathermap:weather-and-forecast:aaa3d98d:local' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Internal error: 500001
2018-11-29 20:09:58.088 [hingStatusInfoChangedEvent] - 'openweathermap:weather-api:aaa3d98d' changed from ONLINE to OFFLINE

Yes, does that to me too and it comes back online

Before I tried this binding, I used the OH1 weather binding for OWM.

With that binding, there I are some more values available. At least I had those before:

{weather="locationId=home, type=temperature, property=feel"}
{weather="locationId=home, type=atmosphere, property=pressureTrend"}

Is it planned to add them also to this new binding?

Does anyone know if the Channel openweathermap:weather-and-forecast:api:local:current#time-stamp pulls info into the DateTime Item in UTC or local TZ?

edit: found it… added %1$tz and saw that it is using local (the default set in my i18n)… good :slight_smile:

Hi Ulrich,

Boot is not. Because those information are not delivered by the OWM API but calculated by the weather binding itself. I do not want to implement calculations inside the OWM binding. If you really need them I suggest to setup a rule for it.

IIRC an experimental binding for weather calculations is available via the Eclipse Marketplace.

Yes the binding transforms every DateTime information to your local timezones.

1 Like