openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.7k forks source link

[Weather Binding] Wrong URL for OpenWeatherMap #5723

Closed maihacke closed 5 years ago

maihacke commented 5 years ago

The Binding uses the wrong URL for retreiving forecast data for OpenWeatherMap. In the log you will see the following error: [eather.internal.bus.WeatherPublisher] - Weather forecast day 0 not available for locationId 'home', only 0 available

Looking in https://github.com/openhab/openhab1-addons/blob/master/bundles/binding/org.openhab.binding.weather/src/main/java/org/openhab/binding/weather/internal/provider/OpenWeatherMapProvider.java it seems it tries the following URL "http://api.openweathermap.org/data/2.5/forecast/daily?lat=[LATITUDE]&lon=[LONGITUDE]&lang=[LANGUAGE]&cnt=5&mode=json&units=metric&APPID=[API_KEY]";

The correct URL is "http://api.openweathermap.org/data/2.5/forecast/?lat=[LATITUDE]&lon=[LONGITUDE]&lang=[LANGUAGE]&cnt=5&mode=json&units=metric&APPID=[API_KEY]";

9037568 commented 5 years ago

Once again, as has been discussed before, the URL is not wrong.

maihacke commented 5 years ago

Can you point me to the discussion. I was looking for this issue in the community forum and here without success.

maihacke commented 5 years ago

Had another look into the api docs for owm. The daily URL is for the 16-days forecast, which is only available for paying customers. This is a little bit odd since I only need the forecast for today. And with the current code it is not possible to use the available forecast.

maihacke commented 5 years ago

The mention discussion is propably #5309