Announcing OpenWeatherMap binding for Eclipse SmartHome / openHAB

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:-
https://api.openweathermap.org/data/2.5/forecast?APPID=yourapikey&q=London,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"
when
  Item Windgeschwindigkeit changed or
  Item Windrichtung changed
then
  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)
  Wind_Geschw_und_Richtung.postUpdate(Ausgabe)
end

(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"
when
    Item localCurrentWindSpeed changed or
    Item localCurrentWindDirection changed
then
    Wind_Geschw_und_Richtung.postUpdate((localCurrentWindSpeed.state as QuantityType<Speed>).toString + " aus " + transform("SCALE", "wind.scale", localCurrentWindDirection.state.toString))
end
1 Like

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

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

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

2 Likes

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 ?

Mirko

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 0.10.0.201811281422 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

Thanks for your feedback.
I understand your point and will look if I find a solution for the felt temperature.

Here is a link:

1 Like