Help OpenWeatherMap Getting 401: Unauthorized

I have a rule setup for the winter to manage using either my heat pumps or oil furnace based on low temperature. Since its that time of year again I noticed the weather data has not been updated since 7/29/2024. The logs seem to report that the request is Unauthorized. I verfied the API KEY status from my OpenWeatherMap account and its listed as active, there were no blocked requests, and everything looked ok, so I am not sure whats going on.

Im using the Free Plan with the noted limits Hourly forecast: unavailable, Daily forecast: unavailable, Calls per minute: 60, 3 hour forecast: 5 days.

2024-11-23 01:49:33.233 PM warn OpenWeatherMap.org Weather Driver - WARNING: 401:Unauthorized
2024-11-23 01:49:33.227 PM warn OpenWeatherMap.org Weather Driver - WARNING: Calling https://api.openweathermap.org/data/2.5/onecall?lat=42.411780&lon=-71.143110&exclude=minutely,hourly&mode=json&units=imperial&appid=(key redacted)

In searching for answers I did note that the free plan was going a way, but all signs seem to point to my key still active. I also seem to be able to make other requests from a home grown application that appear to pull weather data with the same key. So I don't know whats going on.

Any help / suggestions would be much appreciated. Thanks in advance!

When I converted to the new V2 API, it took about 30 mins for it to be activated.... I am using the @Matthew (Scottma61) version of OpenWeather

Hi Kurt,

Thanks for your quick reply. I am using the same driver/app from @Matthew and I have had the key around for many years. So its been activated and the status on my account for OpenWeatherMap shows it as active.

I am not sure what you mean by the new V2 API is that a recent change? do I need to create a new API key for this, or are there other steps that I need to take to do this conversion, Any links would be most appreciated.

Thanks,
Pat

No, you need to switch to either the builtin driver (for the time being) to continue to use the 2.5 API, or switch to 3.0 version and use the community driver. Please note that 3.0 version requires an OpenWeather subscription with a valid credit card on file: Weather API - OpenWeatherMap

If you are wondering what version you are using, look at the error in the logs. If the path is ...2.5/onecall that is 2.5 version, which stopped working. If the path shows ...3.0/onecall, then you migrated to 3.0 version.

2 Likes

Opps, sorry @dunkin, I meant version 3.0 API string from Openweather's website. You need to add a credit card on file to obtain a V3.0 string, but you will not be charged if you set a max limit to restrict the number of daily API calls to stay within the 'free' limit.

Then you can change your @Matthew device driver to use Api Version 3.0 with this boolean switch in the device.

2 Likes

Ah ok, thank you guys, I get it. So OWM did shutoff the 2.5 API (hrm I don't know why my other non-hubitat related script still works). And ill need to start using the 3.0 API with a credit card added to my account.

Sad to see all the weather free APIs go away, first weather underground, then dark sky and now OWM. I understand but yeah still sad.

1 Like

The built-in Hubitat driver still works because is not hitting this end point: https://api.openweathermap.org/data/2.5/onecall

1 Like

Ah yes, I just checked and my script is also using this other URI. Got it one less mystery. Cool thank you for your help. I did subscribe to the 3.0 API. Ill set the limits and hope not to go over the free maximum tho its not an unreasonable price for low volume single house hold if i ever do go over.

Thanks again for your help!

I feel it is important to let those converting to the 3.0 API know that Openweather data is only refreshed every 10 minutes. So making calls more frequently is needless. At that rate, the chance of getting charged is next to impossible (144/day).

3 Likes

Yeah totally true. The important factor is if you use the same account for other applications/uses, but still 1000 calls a day is a healthy buffer.

1 Like