Weather binding with OpenWeatherMap API


(Bernard Mentink) #1

Hi,

I am trying to get this binding to work with OpenWeatherMap … I have the following settings:
But no temperature is returned … just -°C

Config:

apikey.OpenWeatherMap=b237338ea06xxxxxx0568281309a
location.home.latitude=44.625
location.home.longitude=13.890
location.home.provider=OpenWeatherMap
location.home.language=en
location.home.updateInterval=10

Item:

Number Temperature “Temperature [%.2f °C]” {weather=“locationId=home, type=temperature, property=current”}

SIteMap:

Text item=Temperature label=“Current Temperature” icon=“temperature”

I presume the locationid can be any name I choose?? (currently “home”)
I have registered an API key and it does work, as I have used elsewhere from a JSON script.

Any idea’s what could be wrong?


(Vincent Regaud) #2

Please use the codes fences

You define a label for your item in the item defininition
And then you define a label again in the sitemap…
I recommend that you put everything in the item definition
That keeps the sitemaps simple.
A typical item goes like this:

itemtype itemname "labeltext [stateformat]" <iconname> (group1, group2, ...) ["tag1", "tag2", ...] {bindingconfig}

Item:

Number Temperature "Temperature [%.2f °C]" <temperature> { weather="locationId=home, type=temperature, property=current" }

Sitemap:

Text item=Temperature

(Sebastian) #3

I think you are talking about the “old” oh1.x Weather binding. Right?

Then maybe this can be interesting for you


(Bernard Mentink) #4

Thanks @hannibal29

Yes, I was using the old Version 1 weather binding.
I will try the new one, how do I install that extension? It does not say in the README how to install …

Cheers


(Sebastian) #5

Hi Bernard,

Not sure if I’m up to date but I think the binding is not yet part of the latest openHAB distribution. You can install it via the Eclipse IoT marketplace.
More details on how to do that can be found here

And according to the binding doc you have to be on openHAB 2.3 or newer.


(Vincent Regaud) #6

It does say in the link above


(Bernard Mentink) #7

That statement does not help … say’s what? in what link? please be specific …

@hannibal29
Thanks, that was very helpful, I see a new binding called:

OpenWeatherMap Binding
market:binding-4126092 - 1.0

I presume that is it…


(Vincent Regaud) #8

This link


(Bernard Mentink) #9

@vzorglub… and as I said, that link does not tell you how to install the binding, all it says is :

You can add it to your system via the Eclipse IoT Marketplace or manually.

It does not say “how” to install it, nor in the github documentation … @hannibal29 gave me the information I needed … but thanks anyway … :slight_smile:

Cheers


(Bernard Mentink) #10

Ok, I have a Local Weather “thing” “On-Line” via the PaperUI … I now want to include a reference to it’s channel in my item file which is currently in a local “conf” folder on my openHAB server (i.e a local install)

Where does the PaperUI store all it’s files (i.e. .things, .items etc) it must be in a different place than my locally installed files … because I don’t see the .things there that I just created with the UI…

(I have done all my other site configuration in local files under “conf” directory in my home folder (on Linux))


(Bernard Mentink) #11

Last question: I have a “Local Weather” thing, with a “Current Weather” section but it has no temperature “channel” to link my item to … just a bunch of other channels: #condition, #icon etc

i.e openweathermap:weather:api:local:current#temperature is not there …


(Sebastian) #12

The configuration via PaperUI is not stored in a configuration file like the manual configuration but in a database. I don’t know at the moment the exact location of this database but it shouldn’t be edited manually anyway.

But it is no problem to mix UI based configuration with text based configuration. I recommend this part of the docs for some further reading

So in your case you can define the items in a *.items file and link them to the channels of the weather things stored in the database. To find out the channel names just copy and paste them from PaperUI or use VS code as editor.


(Bernard Mentink) #13

@hannibal29
Thanks. However I am still not seeing the #temperature channel to link my item to …
Is it because I am running 2.3.0 version of OpenHAB?

If so, what is the correct way to upgrade a manual install (I have an un-zipped intsall image in my home folder on my Linux box) I tried un-zipping the latest snapshot of 2.4.0 to home, and restarted openhab, but the version still shows 2.3.0

EDIT: It seems to be upgraded now, I connect to openHAB with karaf and it says the version 2.4.0-SNAPSHOT Build#1378
It is very confusing though, as when I use my phone to see the website it states version 2.3.0 Build #1378 … weird…


(Bernard Mentink) #14

Anyone?


(SiHui) #15

(Bernard Mentink) #16

Yes I did see that, and as mentioned earlier I have upgraded. But, that is not the question I wanted answering at the moment. I still have no #temperature item … how do I get it, I don’t need #snow #ice etc … :slight_smile:


(Sebastian) #17

How does the thing in PaperUI look like? Which channels are shown? How does your items file look like? Are the other channels for your current weather thing working? What happens in the logs if you try to setup the temperature channel? Need more information to have a chance to help here.

If the channel really isn’t there it’s maybe worth opening an issue on github or posting your problem in the original development thread for the binding posted above to get in contact with the binding developer @cweitkamp


(Bernard Mentink) #18

I will answer those questions, but at the moment I have bigger issues.

After the upgrade I no longer have MQTT bindings or action, they have disappeared from the PaperUI, so I can’t talk to any of my hardware …

I tried afresh install of openhab-2.4.0-SNAPSHOT.zip and did a restore from my backup, but still the same , no MQTT …

Any idea’s would be most appreciated … my plants are running dry … :frowning:


(Bernard Mentink) #19

@hannibal29
Here is what my thing looks like, everything but temperature …

My temperature item is:

Number:Temperature CurrentTemperature "Current temperature [%.1f C]" <temperature> { channel="openweathermap:weather:api:local:current#temperature" }

… but of course that won’t work if the channel is not there :slight_smile:


(Christoph Weitkamp) #20

Hi all,

Let me chim in for a second. We had a similar discussion in the original thread. The binding will not work with OH2.3. It depends on features which are available in the latest snapshot or since OH2.4.M3 milestone build.

@bmentink After a successful upgrade you have to recreate an existing thing. New channels are not added automatically by the framework to them.

If it does not work afterwards may I ask you to provide a DEBUG log. Thanks.