Weather Binding: Invalid API key

Tags: #<Tag:0x00007fc8f84fd940> #<Tag:0x00007fc8f84fd878> #<Tag:0x00007fc8f84fd7b0>

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?

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

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

apikey.OpenWeatherMap=9e416400ab88f7aa9b162c650dXXXXXX

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

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…

it works! getting lots of information xP
yup the binding got some problems, I downloaded a binding from github 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.
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

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:

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

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

Hey there=)

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

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

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

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

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

  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.

Best Regards!

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.

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

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). 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}).

Hey there,

what does this mean?

I am more that GUI kind of guy^^

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

Best Regards Felix

Prime cause is that the forecast daily is no longer included in the FreePlan of OW, read this OW-conversation. 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)"

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

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