Openweather-API OneCall stops after several days with Exception

Hello!

I added the OpenWeatherMap#OneCallApi to my OH3.1 installation.
Things are online, Item get’s updated. All works correctly.
After several days the update stops. In the Logs I’ve discovered an exception

2021-08-20 19:03:52.214 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:
java.lang.NullPointerException: null
        at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapOneCallHandler.updateMinutelyForecastChannel(OpenWeatherMapOneCallHandler.java:385) ~[?:?]
        at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapOneCallHandler.updateChannel(OpenWeatherMapOneCallHandler.java:262) ~[?:?]
        at org.openhab.binding.openweathermap.internal.handler.AbstractOpenWeatherMapHandler.updateChannels(AbstractOpenWeatherMapHandler.java:166) ~[?:?]
        at org.openhab.binding.openweathermap.internal.handler.AbstractOpenWeatherMapHandler.updateData(AbstractOpenWeatherMapHandler.java:137) ~[?:?]
        at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapAPIHandler.updateThing(OpenWeatherMapAPIHandler.java:176) ~[?:?]
        at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapAPIHandler.updateThings(OpenWeatherMapAPIHandler.java:167) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]

Except the OpenweatherApi-Items all other Things/Items works correctly.

Manual Workaround:

  • disable Bridge Thing by UI
  • enabled Bridge Thing again by UI
  • all works again for several days

Platform information:

  • Docker Image openhab/3.1.0
  • OS: linux

Any ideas or thoughts?
Many thanks!

Oliver

It looks like in rare cases openweathermap does not deliver minutely forecast data in the API response, and this is not handled properly by the code. I added a null pointer check for that case; find a test version at

I don’t know whether it is easy (or even possible) to test this with the docker image. If it is, I would be glad if you could test it. If it isn’t, I can test it for you, but I need your openweathermap config for this, especially the location and the minutely things you defined, as this is where the error occurs.

Yours sincerely

Wolfgang

Hi Wolfgang, many thanks for looking into it.

Sure I can test the fix on my installation. Problem is, that I’m running the last stable release, 3.1.
Could you provide the fix for the 3.1? That would be awesome.

Kind Regards,
Oliver

I did the NPE-fix myself on base of the 3.1.0 branch.
…now testing.

ok, after nearly a month, no problem occured with the fix. so it works fine.

Dear @ehora , sorry for staying silent for so long!

I was busy first, then I saw you already did the fix yourself. Many thanks for that! Do you plan to open a PR with the fix?

Yours

Wolfgang

Hi @Wolfgang1966, no problem.

PR is already opened: https://github.com/openhab/openhab-addons/pull/11255
It’s my first for OpenHAB. Can you check? Is something missing?

Many thanks!

Thanks for your contribution. I reviewed your PR and approved it. Now lets wait for a second approval and merge….