[SOLVED] Can't retrieve OpenWeatherMap data. Invalid API key

Are you trying to access forecast data?

Yes, I have some item… Forecast Temperature, Temperature feel, Condition, Visibility, etc… But none of them gets null or not updating, I can see all item states…

This is because the api/access has changed, use the new binding

That is the reason for the message you can see in your log file. The forecast of the Weather binding uses the daily forecast API of OWM. This is not free for everyone, you have to purchase at least a Startup license to use it. Unfortunately the Weather binding does not support the free hourly forecast API. I like to invite you to have a look into the new OWM binding. It supports both forecast versions. Switching to it will cost some time, but there are new features which are worth the effort.

Thanks, I’ll change the binding

I have tried the binding. I have added a bridge with my API key, but it stays offline. However after adding it, in the inbox Current Weather and 3 hour forecast showed up, but when I added it, it stayed offline…

The things should tell you why they stay offline. Did you looked into your event.log or openhab.log files?

I have tried it, when I add the item, I get this in the log:

2018-09-04 21:56:28.206 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'openweathermap:weather:api:local' to inbox.

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

2018-09-04 21:56:28.268 [home.event.InboxAddedEvent] - Discovery Result with UID 'openweathermap:hourly-forecast:api:local' has been added.

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

2018-09-04 21:56:28.267 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'openweathermap:hourly-forecast:api:local' to inbox.


When I enter the API key, only this what I can see in the log…

2018-09-04 21:58:54.387 [me.event.ThingUpdatedEvent] - Thing 'openweathermap:weather-api:api' has been updated.

2018-09-04 21:58:54.401 [hingStatusInfoChangedEvent] - 'openweathermap:weather-api:api' changed from UNINITIALIZED (HANDLER_CONFIGURATION_PENDING) to INITIALIZING

2018-09-04 21:58:54.411 [hingStatusInfoChangedEvent] - 'openweathermap:weather-api:api' changed from INITIALIZING to UNKNOWN

A minute later…

2018-09-04 21:59:54.412 [hingStatusInfoChangedEvent] - 'openweathermap:weather-api:api' changed from UNKNOWN to OFFLINE

The API thing stays offline as long as no other thing has been added. Try to add the current weather or the hourly forecast thing and wait for the next refresh - default value is 60min. To speed up the refresh you can edit the API thing configuration after adding another thing. This will reinitialize the connection to the API.

Thanks, I have changed the refresh to 10 min, so I’ll wait and see if it makes any change… I have added a Current Weather thing which is linked to the API thing

Evening gentleman,

I have exactly the same problem with Invalid API key while all the values are still being updated as expected on OH. So I have followed advices and installed owm later addon (jar file) as still using OH 2.3.0.

Looking at this new OWM binding I can tell that it has a lot of information and probably I will only be interested with few items instead of everything (free stuff :grinning:)

Below is the list of my current channels which I would like to continue updating with new binding.

Out%20temp

Just want to be make sure that each of these channels are available on free account. So would you be able to confirm which of these items are free please and if you would be able to drop me items from the demo that would be fab.

Many thanks

The new OWM supports units of measurement for the number channels.
I’m not sure that works in OH2.3??

Just copy/edit the selected localCurrentxxx Items you want from the copious examples in the docs

Thanks @rossko57

Forgot to mention that I can only see the following channels under “current weather” section. As you can see the current temperature is not there :disappointed:

Older versions (e.g. for OH2.3 release) are not supported anymore.

That explains All - thank you. I have reason to further delay the upgrade to version 2.4.0 any longer. Got myself a weekend task :grinning:

openHAB 2.4
Ubuntu 18.04 (lxd/lxc container)
I have experienced the same issue with the Weather Binding and OpenWeatherMap as a provider (API error messages in the log). After switching to ForecastIo / Dark Sky API, everything works fine, no error messages related to API. Dark Sky free API is much more generous than OpenWeatherMap’s one.
When I added location, e.g. location my-home. in weather.cfg (/etc/openhab2/services) and later on changed it to location.home my openhab.log has been flooded with errors, like "there is no location my-home". For some reasons, /var/lib/openhab2/config/org/openhab/weather.cfg contains all old, removed from the /etc/openhab2/services/weather.cfg, records. After cleaning it, my weather binding works as expected.
Just in case, if someone, like I was, is struggling with the html part, which is really nice when it works and added to the HABpanel as a frame widget:

  1. /var/lib/openhab2/webapps/weather-data/layouts/example.html
  2. /etc/openhab2/html/weather-data/images
  3. /etc/openhab2/html/weather-data/layouts

example.html (in both locations):
prepend /static/ to everything that starts with /weather-data (href, src)

Do we really need all that weather provided info for the home automation projects?

It’s up to you.
However you should use the new 2.X bindings. Darksky (if I’m right) and also OpenWeatherMap has it’s own new binding which works fine…

I do not see any Darksky bindings and regarding OpenWeatherMap, I do not know how it works with the same free API which is quite limited. Unless, the new binding code calls only for what OpenWeatherMap API provides for free. I do not consider any paid weather services, ever.

https://www.openhab.org/addons/bindings/darksky/ here it is

I also don’t pay anything, and I don’t want to. Basically it is almost unlimited if I remember correctly, only the forecast data is not included in the free-tier (so only “live” weather). But I don’t think that the forecast has any good for a home automation…

This is what OpenWeatherMap API call returns:

coord
lon 174.77
lat -36.85
weather
0
id 800
main “Clear”
description “clear sky”
icon “01d”
base “stations”
main
temp 296.66
pressure 1018
humidity 68
temp_min 294.15
temp_max 300.37
visibility 10000
wind
speed 4.1
deg 200
clouds
all 0
dt 1574811323
sys
type 1
id 7345
country “NZ”
sunrise 1574787420
sunset 1574839195
timezone 46800
id 2193733
name “Auckland”
cod 200