openhab / openhab1-addons

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

[weather] OpenWeatherMap API key failure due to discontinuation of FORECAST on the free plan #5837

Open ptrooms opened 5 years ago

ptrooms commented 5 years ago

Hello, appologies upfront as I try to get the hang of operations how to do and communicate things......

Expected Behavior

The OpenWeather bundle should not generate an API key error. This is started since OpenWeather.com decided that FORECAST calls are part of the 16 day packages. See conversation on OpenWeather.org#17136552

Current Behavior

When using the OpenWeather Binding, everytime the sensors are update, I receive

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

Possible Solution

Updating the bundle-provider source ../addons1/bundles/binding/org.openhab.binding.weather/src/main/java/org/openhab/binding/weather/internal/provider/OpenWeatherMapProvider.java

by returning null for getForecastUrl() in overriding class OpenWeatherMapProvider ....

    @Override
    protected String getForecastUrl() {
        return null;
    }

in stead of (failing, giving the error message)

    @Override
    protected String getForecastUrl() {
        return FORECAST;
    }

Context

The log is flooded with errors which distracts and simply annoys.

My Environment

OpenHab 2.2.0 on a Qnap-TS-509/Busybox implementation

Kind Regards, Peter

Note: I already solved it myself by updating the Java code and integrating (as add-on) it into openhab. I tried to fork/pull my Git-fork as-branch owapi and (of course) I cannot (as I do not yet understand howto) propose my own forked GIT changes into the [https://github.com/openhab/openhab1-addons]

5iver commented 5 years ago

I'm not a maintainer and do not know if your changes would be accepted, but #5836 was OK... not sure why you closed it.

9037568 commented 5 years ago

5836 would have been a good start, but changes would be needed.

ptrooms commented 5 years ago

I'm not a maintainer and do not know if your changes would be accepted, but #5836 was OK... not sure why you closed it.

Simple answer: I do not (yet) know how/what I (have to) do to propose a code modification. Feeling like a trainee again. Getting involved into openHAB aside from coding itself, is challenging (unstanding the environment, policy learning for doing things etc.etc.).

Checking myself, yes. A proposal to fix will likely be incomplete. I primarily "patched" the code (to eliminate de FORECAST call error) instead of properly "modify" for functionality that implement the FORECAST option as a configuration choice. Perhaps, others may have a paid plan and thus WILL want to use the FORECAST option.

I did a pull-request on "addons1" but for vague reasons it was (redd-cross) rejected such as "forgot to signoff" and others, after I best closed the issue. Also not to stress the nice community with my "ignorances". Thanks for your assistance & understanding. Still learning the "git" proces...

ptrooms commented 5 years ago

Made a little GIT progress pushing/pulling "a proposed fix" which I renamed from owapi to #5837 on my fork....... not now sure how to continue. Appo's for my newbie actions and thanks for your patience.

9037568 commented 5 years ago

Since you deleted the original branch, you'll now have to start a new PR.

ptrooms commented 5 years ago

In learning, I've pulled/renamed to #5838 with "my" proposed fix on my-fork which now went successful in checks and now, it is stated as (I'm proudly ;) ) want to merge.
Aside from (possible code/direction comments, would that be enough for kings & dragons ?

bkadykalo commented 4 years ago

5-days forecast works well with a free account - just need to drop /daily from endpoint