Announcing OpenWeatherMap binding for Eclipse SmartHome / openHAB

:+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:-
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