OpenWeatherMap

Hi,

Since the update to OH 4.2, I notice that the OpenWetherMap doesn’t update automatically.
I changed to the API version 3 some time ago, so that should be OK.
When I disable and re-esable the local forecast, I see one update, but then it stops.

Anyone experiencing similar issue?

I can also see a warning, not sure if it is connected to the problem.

2024-07-27 21:58:26.491 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.NullPointerException: Cannot invoke "org.openhab.binding.openweathermap.internal.dto.onecall.Current.getDt()" because the return value of "org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapOneCallHistAPIData.getCurrent()" is null
	at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapOneCallHistoryHandler.updateHistoryCurrentChannel(OpenWeatherMapOneCallHistoryHandler.java:139) ~[?:?]
	at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapOneCallHistoryHandler.updateChannel(OpenWeatherMapOneCallHistoryHandler.java:108) ~[?:?]
	at org.openhab.binding.openweathermap.internal.handler.AbstractOpenWeatherMapHandler.updateChannels(AbstractOpenWeatherMapHandler.java:165) ~[?:?]
	at org.openhab.binding.openweathermap.internal.handler.AbstractOpenWeatherMapHandler.updateData(AbstractOpenWeatherMapHandler.java:136) ~[?:?]
	at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapAPIHandler.updateThing(OpenWeatherMapAPIHandler.java:186) ~[?:?]
	at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapAPIHandler.updateThings(OpenWeatherMapAPIHandler.java:176) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
	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:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:840) [?:?]
2024-07-27 21:58:26.879 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.NullPointerException: Cannot invoke "org.openhab.binding.openweathermap.internal.dto.onecall.Current.getDt()" because the return value of "org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapOneCallHistAPIData.getCurrent()" is null
	at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapOneCallHistoryHandler.updateHistoryCurrentChannel(OpenWeatherMapOneCallHistoryHandler.java:139) ~[?:?]
	at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapOneCallHistoryHandler.updateChannel(OpenWeatherMapOneCallHistoryHandler.java:108) ~[?:?]
	at org.openhab.binding.openweathermap.internal.handler.AbstractOpenWeatherMapHandler.updateChannels(AbstractOpenWeatherMapHandler.java:165) ~[?:?]
	at org.openhab.binding.openweathermap.internal.handler.AbstractOpenWeatherMapHandler.updateData(AbstractOpenWeatherMapHandler.java:136) ~[?:?]
	at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapAPIHandler.updateThing(OpenWeatherMapAPIHandler.java:186) ~[?:?]
	at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapAPIHandler.lambda$2(OpenWeatherMapAPIHandler.java:145) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:840) [?:?]

All I can really say is it’s worked for me flawlessly through the upgrade and the warning does indeed look relevant. It seems like it can’t get anything from the history endpoint of the API. Are us using the history Thing? If you disable that Thing does local forecast start working or does the warning change?

Finally, when posting anything to the forum that has a “Code” tab in MainUI, please click on the code tab and post the text you find there. Use code fences.

```
code goes here
```

Screen shots are never complete, cannot be searched, copy/paste/edit, etc. Be sure to redact sensitive info from the text where appropriate.

Thanks, seems like a problem in my thing text configuration, the channels had different links.
I created the things from UI and it works.
I will look in more details in the weekend.

I use fences. Maybe something else is wrong.

Here’s the screenshot (I know it’s not searchable but only way to prove I guess :slight_smile: )

Code fences is this icon:
Screenshot from 2024-08-01 16-47-51

Is that what you are using?

I use ‘’’

2024-07-27 21:58:26.491 [WARN ] [mmon.WrappedScheduled

Issue is also reported here

The NPE has been fixed and a jar is available for download. Check the related PR

Rich was recommending to paste the code for your thing instead of the screenshot you posted. The bit about code fences was just a reminder.

In the case of OWM, that gives us a nice, concise definition for the account.

UID: openweathermap:weather-api:ACCOUNTID
label: OpenWeatherMap
thingTypeUID: openweathermap:weather-api
configuration:
  language: en
  apiVersion: "3.0"
  apikey: ********************************
  refreshInterval: 10

I haven’t moved to 4.2 yet, but in 4.1 I also need a separate thing for the One Call API, which is where the channels are.

UID: openweathermap:onecall:ONECALLID:local
label: "OpenWeatherMap: One Call API"
thingTypeUID: openweathermap:onecall
configuration:
  numberOfAlerts: 0
  location: X, Y
  forecastHours: 12
  forecastDays: 6
  forecastMinutes: 0
bridgeUID: openweathermap:weather-api:ACCOUNTID
channels:
  CHANNELS GO HERE

OK, I got it.

I almost never use the Main UI configuration so I didn’t figure out that I need to copy the code of the Main UI configuration tab of the thing.
I will keep that in mind

They are quotes and not back ticks which are the ones top left of qwerty keyboard US.

These are quotes     '''
These are back ticks ```

You should use back ticks.
You will know if it is working as you will see the text in the formatted way on the right f the screen.

Yes the character are “back ticks” in the original post, I was writing my answer from my phone and I even didn’t notice the difference.
Below is another screenshot from the original post in edit mode

image

The text on my display is shown formatted, see screenshot in my previous post

Thanks, I will try the jar during this weekend
Can you please confirm this is the last version?

https://1drv.ms/u/s!AnMcxmvEeupwjvw-BPBJwbpfUh-pWQ?e=UaqTdj

Yes it is the latest

Hi,
I am on openHAB 4.2.0 and have a problem with the openweathermap binding.
changed api account from 2.5 to 3.0 => OpenWeatherMap Account is online.
But my Local Weather and Forecast (One Call API) thing gives me this error : Status:

OFFLINE

CONFIGURATION_ERROR

Invalid API key. Please see h ttps://openweathermap.org/faq#error401 for more info.

Have removed old binding and used the latest 4.3.0 jar in addons
I use the free plan who was working before until 06/2024 as the 2.5 stopped
read the faq#error 401 and do not find why i receive this error.

Any idea how ii can fix this.
Thanks
Patrick

Did you sign up for the new API and get a new API access key? The old 2.5 API does not automatically transfer to 3.0. You have to reapply and sign up for the 3.0 API on the OWM site.

Hi rlkoshak,

I logged on my openweathermap account and regenerated the api key.
Copied the key to the openhab binding and after a few seconds, got the green online;

Today i got back to the One call 3.0.page
Do i have to subscribe again, i already have a account?

I tried the subscribe button, but i suddenly got a screen with payment info and no “free plan” as i had before. Did they remove the free plan?

Thanks

Patrick

Yes

No, the free plan is still free up to 1000 cals per day. But they require payment info in case you go over your daily limit on the free plan. You cannot sign up even for the free plan without giving them payment info but if you stay within your limit they never charge you.

But this was also the case a few years ago for the 2.5 API. As long as I’ve used OWM they’ve always required payment info to sign up.

Ok, Thanks for the info.
Will try it.
Patrick