# Weather Binding: Invalid API key

**URL:** <https://community.openhab.org/t/weather-binding-invalid-api-key/59321>\
**Category:** Bindings\
**Tags:** weather, openhab2, openweathermap\
**Created:** [December 9, 2018, 9:41pm UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321 "2018-12-09T21:41:05Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon63824877](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/b5a626/32.png) [@anon63824877](https://community.openhab.org/u/anon63824877)\
**Post date:** [December 9, 2018, 9:41pm UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/1 "2018-12-09T21:41:05Z")

</div>

Hey there =)

I am having issues with the weather binding. My log always says that I got an invalid API key.  
I am using OpenWeatherMap with the free keys. However when copying the keys from their website and putting them into my wather config file

```
weather:apikey.OpenWeatherMap=9e416400ab88f7aa9b162c650dXXXXXX

```

it always says

```
[ERROR] [nal.provider.AbstractWeatherProvider] - OPENWEATHERMAP[home]: Can't retreive weather data: Invalid API key. Please see http://openweathermap.org/faq#error401 for more info.

```

this error continues after creating a new account on their website and using a new API key. Anyone got an idea?

---

<div class="post-metadata">

**Author:** ![rossko57](https://community.openhab.org/user_avatar/community.openhab.org/rossko57/32/70263_2.png) [@rossko57](https://community.openhab.org/u/rossko57)\
**Post date:** [December 10, 2018, 2:41am UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/2 "2018-12-10T02:41:51Z")

</div>

This message can be prompted by requesting forecasts that are not allowed for free keys

> [@\[SOLVED\] Can't retrieve OpenWeatherMap data. Invalid API key](https://community.openhab.org/t/solved-cant-retrieve-openweathermap-data-invalid-api-key/50727):
>
> Dear Everyone! I have changed from Yahoo to OpenWeatherMap, because Yahoo was really unrealiable and stopped working completely in the last days. OpenWeatherMap seems good for me, I have created an account, got an API key. If I issue an API call with my key, it works perfectly. OpenHab also shows all the data. However I get this error every time… Can't retreive weather data: Invalid API key. Please see http://openweathermap.org/faq#error401 for more info. Does anyone know why? Thanks!

---

<div class="post-metadata">

**Author:** ![vzorglub](https://community.openhab.org/user_avatar/community.openhab.org/vzorglub/32/17166_2.png) [@vzorglub](https://community.openhab.org/u/vzorglub)\
**Post date:** [December 10, 2018, 7:27am UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/3 "2018-12-10T07:27:57Z")

</div>

Don’t put `weather:` in front of your config lines:

```auto
apikey.OpenWeatherMap=9e416400ab88f7aa9b162c650dXXXXXX

```

---

<div class="post-metadata">

**Author:** ![Basse\_03](https://community.openhab.org/user_avatar/community.openhab.org/basse_03/32/67939_2.png) [@Basse\_03](https://community.openhab.org/u/Basse_03)\
**Post date:** [December 10, 2018, 1:51pm UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/4 "2018-12-10T13:51:35Z")

</div>

Hi!  
I have the very same problem.  
The problem seems to be that this binding sends like:  
[http://api.openweathermap.org/data/2.5/forecast/daily?lat=58.xx&lon=15.xx&lang=se&cnt=5&mode=json&units=metric&APPID=495cxx](http://api.openweathermap.org/data/2.5/forecast/daily?lat=58.xx&lon=15.xx&lang=se&cnt=5&mode=json&units=metric&APPID=495cxx)  
But it should be as:  
[http://api.openweathermap.org/data/2.5/forecast?lat=58.xx&lon=15.xx&lang=se&cnt=5&mode=json&units=metric&APPID=495cxx](http://api.openweathermap.org/data/2.5/forecast?lat=58.xx&lon=15.xx&lang=se&cnt=5&mode=json&units=metric&APPID=495cxx), or something similar, at least it doesn’t work with daily.  
Please try, and if it works with the second link I assume that the binding has to be redesigned.

BR Örjan

---

<div class="post-metadata">

**Author:** ![anon63824877](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/b5a626/32.png) [@anon63824877](https://community.openhab.org/u/anon63824877)\
**Post date:** [December 10, 2018, 10:23pm UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/5 "2018-12-10T22:23:02Z")

</div>

```
2018-12-10 23:18:51.719 [INFO] [eather.internal.common.WeatherConfig] - 
ProviderConfig[providerName=OPENWEATHERMAP,apiKey=9e416400ab88f7aa9b162c6xxxx]
2018-12-10 23:18:51.723 [INFO] [eather.internal.common.WeatherConfig] - LocationConfig[providerName=YAHOO,language=de,updateInterval=10,latitude=<null>,longitude=<null>,woeid=547826,locationId=test,name=<null>]
2018-12-10 23:18:51.727 [INFO] [eather.internal.common.WeatherConfig] - LocationConfig[providerName=OPENWEATHERMAP,language=de,updateInterval=1,latitude=8.52226,longitude=49.051059,woeid=<null>,locationId=<locationId1>,name=704818]
2018-12-10 23:18:51.730 [INFO] [eather.internal.common.WeatherConfig] - LocationConfig[providerName=OPENWEATHERMAP,language=de,updateInterval=1,latitude=47.8011,longitude=13.0448,woeid=704818,locationId=home,name=Weingarten]
2018-12-10 23:18:51.734 [INFO] [eather.internal.common.WeatherConfig] - LocationConfig[providerName=OPENWEATHERMAP,language=de,updateInterval=1,latitude=8.52226,longitude=49.051059,woeid=704818,locationId=home1,name=Weingarten]

2018-12-10 23:18:54.755 [INFO] [ternal.scheduler.WeatherJobScheduler] - Disabling weather locationId 'test', no binding available
2018-12-10 23:18:54.759 [INFO] [ternal.scheduler.WeatherJobScheduler] - Disabling weather locationId '<locationId1>', no binding available
2018-12-10 23:18:54.763 [INFO] [ternal.scheduler.WeatherJobScheduler] - Disabling weather locationId 'home', no binding available
2018-12-10 23:18:54.766 [INFO] [ternal.scheduler.WeatherJobScheduler] - Disabling weather locationId 'home1', no binding available

```

then we are back to this… also I dont now where the locations locationID1 and test are coming from…

---

<div class="post-metadata">

**Author:** ![anon63824877](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/b5a626/32.png) [@anon63824877](https://community.openhab.org/u/anon63824877)\
**Post date:** [December 10, 2018, 10:34pm UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/6 "2018-12-10T22:34:51Z")

</div>

> [@Basse\_03](#):
>
> Please try, and if it works with the second link I assume that the binding has to be redesigned.

it works! getting lots of information xP  
yup the binding got some problems, I downloaded a binding from [github](https://github.com/openhab/openhab1-addons/issues/5309#issuecomment-443626136) from a conversation that talked about the not working of the binding. There they made a snapshot that supposingly works. However I didnt get it to install.

From github:

> I created a version with the free api for forecast.  
> You may download it here [https://github.com/maihacke/openhab1-addons/releases/download/20181202\_own\_free\_forecast/org.openhab.binding.weather-1.13.0-SNAPSHOT.jar](https://github.com/maihacke/openhab1-addons/releases/download/20181202_own_free_forecast/org.openhab.binding.weather-1.13.0-SNAPSHOT.jar).  
> For installation, first uninstall weather-binding via paperui and copy the jar to your addons folder.

is there anything else to do? I unistalled the official one, put the jar into the folder and rebooted. I dont have much knowledge in installing 3rd parties addons

---

<div class="post-metadata">

**Author:** ![Basse\_03](https://community.openhab.org/user_avatar/community.openhab.org/basse_03/32/67939_2.png) [@Basse\_03](https://community.openhab.org/u/Basse_03)\
**Post date:** [December 11, 2018, 10:11am UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/7 "2018-12-11T10:11:39Z")

</div>

Hi!  
Great, so far.  
Please,try,  
You have to had the binding like openhab-runtime-compat1x installed, due to that binding weather is an OH1 Add-on.  
Install this binding as:

# sudo ssh -p 8101 openhab@localhost

pwd = habopen  
openhab\>feature:install openhab-runtime-compat1x  
openhab\>bundle:list

More info:  
[https://www.openhab.org/docs/developer/development/compatibilitylayer.html](https://www.openhab.org/docs/developer/development/compatibilitylayer.html)

Then:  
Place JAR file into your openhab2-addons folder.  
Edit the file \openhab2-conf\services\addons.cfg  
Un-comment and add the binding to this line as follows  
binding = org.openhab.binding.weather, openhab-runtime-compat1x, anymore bindings here  
Restart Openhab2 , #sudo /bin/systemctl restart openhab2.service

It might be that you have to install binding weather also as above, I am a little insecure about that.  
Just try, if it starts without installation, it’s OK.

Best Regards Basse

---

<div class="post-metadata">

**Author:** ![Basse\_03](https://community.openhab.org/user_avatar/community.openhab.org/basse_03/32/67939_2.png) [@Basse\_03](https://community.openhab.org/u/Basse_03)\
**Post date:** [December 11, 2018, 10:30am UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/8 "2018-12-11T10:30:27Z")

</div>

Hi again,  
Just saw that the link you referenced to is regarding to an OH2 ADD-ON, and I do think that this downloaded binding is an OH2 ADD-ON  
The info. I just wrote about is regarding to the older OH1 ADD-ON.  
My apologizes, and just be aware that this is 2 different bindings.

I myself has the OH1-binding running ( I have removed the daily ), but I have not found the code in ESH for the OH2-binding so I can’t compare them. But it might be that there is the very same problem.

Best Regards Basse

---

<div class="post-metadata">

**Author:** ![anon63824877](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/b5a626/32.png) [@anon63824877](https://community.openhab.org/u/anon63824877)\
**Post date:** [December 11, 2018, 9:45pm UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/9 "2018-12-11T21:45:08Z")

</div>

Hey there=)

> [@Basse\_03](#):
>
> I myself has the OH1-binding running

So you got an OH1 Binding? can you give me a link where to download it (and what about the cfg file fore the binding)? and then the installation you talked abput in the post before?

I am sorry, installation of bindings and the linux command line aren’t my speciality^^ A huge Thanks for your help!

Best Regards Felix

---

<div class="post-metadata">

**Author:** ![Basse\_03](https://community.openhab.org/user_avatar/community.openhab.org/basse_03/32/67939_2.png) [@Basse\_03](https://community.openhab.org/u/Basse_03)\
**Post date:** [December 12, 2018, 9:59am UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/10 "2018-12-12T09:59:10Z")

</div>

Hi!  
This is interesting and a little bit confusing about the different versions, isn’t it, but the very good thing is that we have to somehow have it sorted out  
I am still running openHAB 2.3.0 and I’m sure that the Weather binding in this distribution is regarding to OH1 Add-ons.  
#sudo ssh -p 8101 openhab@localhost  
habopen

openhab\>bundle:list  
205 | Active | 80 |1.12.0 |openHAB Weather Binding

I have seen one like 1.13.0 and this one is also an OH1 Add-ons binding .  
Please see, [openhab1-addons/bundles/binding/org.openhab.binding.weather at main · openhab/openhab1-addons · GitHub](https://github.com/openhab/openhab1-addons/tree/master/bundles/binding/org.openhab.binding.weather)

There must have been some changes in the way OpenWeatherMap will deliver the different forecasts, I have just used this binding for a month so I don’t know anything about the past.

Anyhow so can I see the very same link in 1.12.0 and 1.13.0. so I assume that none of these bindings will work as expected, they will booth throw the exception like ‘Invalid API key. xxxx’  
At least if you use the Free account at OpenWeatherMap.

I have redesigned the binding, (changed the link) but this is a very ugly way too handle the problem, due to that I am not the maintainer of this binding. So it works but I can only see forecast for the next 12 hours with steps of 3 hours. I have not distribute it due to that.

So my suggestion is that we try to use the OH2 Add-ons binding.  
As I have seen so is this binding available from: [Announcing OpenWeatherMap binding for Eclipse SmartHome / openHAB](https://community.openhab.org/t/announcing-openweathermap-binding-for-eclipse-smarthome-openhab/46420)

And if there are any similar problems, can we ask for help to solve them in the OH2 Add-ons binding.

Not so much help I think, but maybe a little bit closer to a solution.

Best Regards Basse

---

<div class="post-metadata">

**Author:** ![anon63824877](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/b5a626/32.png) [@anon63824877](https://community.openhab.org/u/anon63824877)\
**Post date:** [January 1, 2019, 8:09pm UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/11 "2019-01-01T20:09:18Z")

</div>

Hey =)  
sorry this took so long for me to awnser^^

> [@Basse\_03](#):
>
> #sudo ssh -p 8101 openhab@localhost  
> habopen

I already got problems with that, I cant figure out how to log into the console.

 ![putty_2019-01-01_21-02-45](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/8/e/8e5efa3635bb482bee6ad808a0673c9d0c3e8721.png)

1. the sudo password
2. habopen as password right? Doesnt work
3. the password for my local user, the password I use to log in into the SSH and the password thats the sudo password

what am I doing wrong?

For the problem itself, I will look into using the OpemWeatherMap Binding as you said.

> [@Basse\_03](#):
>
> Announcing OpenWeatherMap binding for Eclipse SmartHome / openHAB

Best Regards!

---

<div class="post-metadata">

**Author:** ![Basse\_03](https://community.openhab.org/user_avatar/community.openhab.org/basse_03/32/67939_2.png) [@Basse\_03](https://community.openhab.org/u/Basse_03)\
**Post date:** [January 2, 2019, 9:09am UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/12 "2019-01-02T09:09:48Z")

</div>

Hi!  
This is strange, as far as I can see are you doing right.  
I have seen some links about to login, regarding RaspberryPi, It may take a while to be logged in, in some times a couple of minutes.

Please, see also following,  
User password needed for SSH or sudo (e.g. “openhabian:openhabian”)  
Samba share password (e.g. “openhabian:openhabian”)  
openHAB remote console (e.g. “openhab:habopen”)  
Amanda backup password (no default, applied when installing)  
Nginx reverse proxy login (no default, applied when installing) For manual configuration see here.  
InfluxDB (No password set by default)  
Grafana visualization (“admin:admin”)

This link is also about The Console.

> **[The Console](https://www.openhab.org/docs/administration/console.html)**
>
> a vendor and technology agnostic open source automation software for your home

I have just upgraded my openHAB to 2.4 so I will asap have a look at the latest OpenWeatherMap binding too.  
2.4 works just great, I am running openHAB on Linux Mint 18.4 (I will remember) and there is an automated upgrade in this OS, so I used it for openhAB and it works, just have to reboot.

Best Regards Basse

---

<div class="post-metadata">

**Author:** ![cweitkamp](https://community.openhab.org/user_avatar/community.openhab.org/cweitkamp/32/56864_2.png) [@cweitkamp](https://community.openhab.org/u/cweitkamp)\
**Post date:** [January 2, 2019, 11:03am UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/13 "2019-01-02T11:03:57Z")

</div>

Hi Felix,

You can try to access the console via `$OPENHAB_RUNTIME/bin/client` command instead of using ssh.

Did you perhaps changed your password?

To reset the password edit the `/var/lib/openhab2/etc/users.properties` file manually by replacing the password or password hash (including `{CRYPT}`) with your new password in clear text (see section [Changing the Password](https://www.openhab.org/docs/administration/console.html#changing-the-password)). By default, the line with the password contains the text `openhab =` , followed by the current password (e.g. `habopen` ) or a password hash (e.g. `{CRYPT}4AE1A0FD...{CRYPT}`).

---

<div class="post-metadata">

**Author:** ![anon63824877](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/b5a626/32.png) [@anon63824877](https://community.openhab.org/u/anon63824877)\
**Post date:** [January 24, 2019, 9:04pm UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/14 "2019-01-24T21:04:17Z")

</div>

Hey there,

what does this mean?

> [@cweitkamp](#):
>
> via `$OPENHAB_RUNTIME/bin/client` command instead of using ssh

I am more that GUI kind of guy^^

> [@cweitkamp](#):
>
> Did you perhaps changed your password?

Indeed I changed my password. However I only changed the openhab password. This is irrelevant for the console right? And I tried logging in into the console with the original “openhabian” and my changed password.

Moreover I can’t find that file

> [@cweitkamp](#):
>
> /var/lib/openhab2/etc/users.properties

 ![putty_2019-01-24_22-03-19](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/5/d/5dc32a4f9036a8356a96d458c7b8f258343cfb7b.png)

Best Regards Felix

---

<div class="post-metadata">

**Author:** ![PtrO](https://community.openhab.org/user_avatar/community.openhab.org/ptro/32/20966_2.png) [@PtrO](https://community.openhab.org/u/PtrO)\
**Post date:** [March 18, 2019, 4:57pm UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/15 "2019-03-18T16:57:51Z")

</div>

Prime cause is that the forecast daily is no longer included in the FreePlan of OW, read this [OW-conversation](https://openweathermap.desk.com/customer/portal/questions/17136552-api-not-allowing-daily-forecast). Forecast is now part of the 16day Forecast option…  
The “only” free part is a forecast of 3 hours…

The forecast query is called in succession to the standard call and as such, “hard coded” into the (old) bundle weather provision:  
…/addons1/bundles/binding/org.openhab.binding.weather/./src/main/java/org/openhab/binding/weather/internal/provider/ **OpenWeatherMapProvider.java**

One will need to “update/compile” the source (disable FORECAST url) and go into the hassle in updating the platform where OH is running etc.etc.  
Wat I did was updating the source (_OpenWeatherMapProvider.java_) , and nullified ( **return null** ) for “getForecastUrl()”.

Add/update on its own a relatively simple but sequence tedious activity:

1. compile source java/jar (execute **mvn clean install** ) in : ../../addons1/bundles/binding/org.openhab.binding.weather/  
– which will generate a jar file in: ../../org.openhab.binding.weather/target/x.y.z.SNAPSHOT.jar  
– One can also use Eclipse-IDE, export target but I prefer the simple command-line.
2. Remove the old 1.11 weather-binding, best doing this via PaperUI
3. Temporarily move away the ../services/weather.cfg (this will allow openHab to clean the cache).
4. Using the Karaf-console, remove the openweather in-memory config:  
– check existence of: **config:list “(service.pid=org.openhab.weather)”**  
– delete the dynamic config: **config:delete org.openhab.weather**  
– check absence of: **config:list “(service.pid=org.openhab.weather)”**
5. Insert/bring back the weather config file into openhab folder: ../services/weather.cfg
6. Insert/copy the compiled jar-result file ( from step 1) into openhab folder: ../addons
7. Check openhab.log, the binding is swallowed in
8. Verify using Karaf-console:  
– check bundle picked up: **bundle:list | grep Weather**  
– check config picked up: **config:list “(service.pid=org.openhab.weather)”**

---

<div class="post-metadata">

**Author:** ![cgeo](https://community.openhab.org/letter_avatar_proxy/v4/letter/c/3d9bf3/32.png) [@cgeo](https://community.openhab.org/u/cgeo)\
**Post date:** [March 19, 2019, 2:41pm UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/16 "2019-03-19T14:41:01Z")

</div>

I just tried to use this binding for the first time …

I think you are right although I could not see the API call even after enabling DEBUG logging for the binding. The bridge stays offline and I get the same error in the logs

So I guess this binding is officially broken unless somebody changes the API call

---

<div class="post-metadata">

**Author:** ![PtrO](https://community.openhab.org/user_avatar/community.openhab.org/ptro/32/20966_2.png) [@PtrO](https://community.openhab.org/u/PtrO)\
**Post date:** [March 19, 2019, 8:50pm UTC](https://community.openhab.org/t/weather-binding-invalid-api-key/59321/17 "2019-03-19T20:50:01Z")

</div>

Activate the trace to show the API call in Karaf: **log:set TRACE org.openhab.binding.weather**  
The call is not shown in debug.
