Get weather forecast for next using OpenWeather

  • Platform information:
    • Hardware: Raspberry Pi 4
    • OS: Raspberry Pi OS / x64 / 11 (bullseye)
    • Java Runtime Environment: 11.0.15 (Temurin-11.0.15+10) (running in Docker)
    • openHAB version: 3.4.4 (running in Docker)
    • ConBee 2 USB stick

Dear community,

I want to display tomorrow’s weather forecast using the OpenWeather API. I followed this fantastic tutorial, but I’m struggling retrieving the data.

As you can see, I’m using the Free plan, so retrieving tomorrow’s data should be fine:

My OpenWeather account settings seem to be okay:

But when trying to load the forecast, the associated thing just remains Unknown:

What I’d need from the API response are:

  • forecastTomorrow#icon
  • forecastTomorrow#min-temperature
  • forecastTomorrow#max-temperature

But even after several hours, the things remains Unknown and attached items don’t contain any data.

What am I doing wrong?

Thx!

PS: A manual API call against https://api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&appid={API key} with my API key works without issues.

What’s in the log file once you save the thing?

The only log statements related to this thing are:

16:42:20.068 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'openweathermap:weather-and-forecast:36c5a08fe8:local' changed from UNINITIALIZED to INITIALIZING
16:42:20.088 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'openweathermap:weather-and-forecast:36c5a08fe8:local' changed from INITIALIZING to UNKNOWN

When creating a new thing from scratch, the default values are 24 hours / 0 days - using these values, the newly created thing switches to ONLINE immediately.

I get same behavior, but the onecall thing is working fine.
Maybe that’s a workaround for you

But for One call API, I need to pay, right?

No, there is also a free option

Okay, I checked and you’re right: the “One Call API” has a set of free API calls per day, but I’d have to register with my personal data (name, address, credit card, etc.) - I don’t want to do that.

Instead, I’d like to use the other API (which is probably based on https://api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&appid={API key})

Not sure if this changed, but I’m on free plan, without providing any personal or billing data and I can use the onecall thing without issues.

Thats what my openweathermap.org profile is showing:

It looks exactly the same in my profile :dizzy_face: do we maybe have a different understanding of One Call API?
According to this page , it is pay as you go with 1000 requests per day for free. However, when subscribing to this API, I’m forced to enter my credit card data.
Instead, the two of us are currently using the Free plan from what I understand, but I might be wrong.

Anyhow… could you please post a screenshot of your a) your OpenWeather bridge/account settings and b) your current OpenWeather condition settings within openHAB as I did in my original post? I just want to try it with your settings…

I just did try and error and tried to create a one call API thing…

UID: openweathermap:weather-api:319821ab97
label: OpenWeatherMap Konto
thingTypeUID: openweathermap:weather-api
configuration:
  language: de
  apiVersion: "2.5"
  apikey: xxx
  refreshInterval: 10
UID: openweathermap:onecall:319821ab97:local
label: One Call API - Lokales Wetter und Wettervorhersage
thingTypeUID: openweathermap:onecall
configuration:
  numberOfAlerts: 0
  location: xxx
  forecastHours: 12
  forecastDays: 6
  forecastMinutes: 0
bridgeUID: openweathermap:weather-api:319821ab97

1 Like

LOL that just works :rofl: thx man!

1 Like