weatherbit icon indicating copy to clipboard operation
weatherbit copied to clipboard

Error requesting data from WeatherBit: 429

Open Mariusthvdb opened this issue 2 years ago • 33 comments

I have given this some time (as in days), but Integration wont setup anymore:

Logger: homeassistant.config_entries
Source: config_entries.py:388 
First occurred: 22:47:15 (2 occurrences) 
Last logged: 22:47:24

Config entry 'Roosendaal' for weatherbit integration not ready yet: Error requesting data from WeatherBit: 429, message='', url=URL('https://api.weatherbit.io/v2.0/current?lat=xxx&lon=xxx&key=83eredacted88&lang=en&units=M'); Retrying in background

is this a know issue right now? Or did something go Amis in updating to HA 2022.8.6...

thanks!

Mariusthvdb avatar Aug 18 '22 21:08 Mariusthvdb

I just got the same issue after updating.

Logger: homeassistant.config_entries
Source: config_entries.py:1067
First occurred: 4:47:36 PM (1 occurrences)
Last logged: 4:47:36 PM

Config entry 'Country Life Acres' for weatherbit integration not ready yet: Error requesting data from WeatherBit: 429, message='', url=URL('https://api.weatherbit.io/v2.0/current?lat=38.65259474700931&lon=-90.48935672384688&key=f77974adbc6d4efd91ae6ae0b4f69a73&lang=en&units=M'); Retrying in background

B-Kramer avatar Aug 18 '22 21:08 B-Kramer

Followup: It's going over the request limit.

{"status_code":429,"status_message":"Your request count (585) is over the allowed limit of 500 per day - Upgrade your key, or retry after 129.85 minutes"}

B-Kramer avatar Aug 18 '22 21:08 B-Kramer

right, I see that too now, maybe cause by the fact its installed on several devices..? how can we decrease that request count to fall under the 500 in that case?

wait, this seems the place:

Schermafbeelding 2022-08-20 om 01 00 35

Ive now increased from 5 to 10 minutes, which should be significant, lets see what happens next ;-)

Mariusthvdb avatar Aug 19 '22 22:08 Mariusthvdb

In the settings on the integrations page you can increase the poll times. I set mine from 5 up to 10 minutes, didn't hit the limit today.

On Fri, Aug 19, 2022, 5:59 PM Marius @.***> wrote:

right, I see that too now, maybe cause by the fact its installed on several devices..? how can we decrease that request count to fall under the 500 in that case?

— Reply to this email directly, view it on GitHub https://github.com/briis/weatherbit/issues/73#issuecomment-1221153916, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMDZCEPZN6BTASHS3RQOHTV2AGW3ANCNFSM566UA55A . You are receiving this because you commented.Message ID: @.***>

B-Kramer avatar Aug 19 '22 23:08 B-Kramer

haha we crossposted....

Mariusthvdb avatar Aug 19 '22 23:08 Mariusthvdb

There is nothing that has changed in the part of the code that handles the frequencies of updates for month. I have now done some extensive testing just to verify that this is running as expected, and it does.

When you start up HA and the Integration, it performs two calls to Weatherbit on startup: 1 for the current data and one for the Forecast, and then it follows the schedule. So if default values are selected it makes 1 call every 5 minutes for the current data and 1 call every 30 min for the forecast. That means 288 call for current data per day and 48 calls for the forecast per day. That is 336 calls per day, and way below the 500 that is on the Free plan.

The above number also indicates that if you run more than 1 location, then you MUST lower the frequency of updates to ensure you do not hit the 500 calls limit.

briis avatar Aug 20 '22 08:08 briis

Thans Bjarne.

I am not running more than 1 location, but have ofc more than 1 device running HA.

Suppose that should not matter ( considering it is the Ha server doing the requests?)

Mariusthvdb avatar Aug 20 '22 08:08 Mariusthvdb

The above number (336 calls per day) is for each instance of Weatherbit running with 1 location setup. So if you use the Integration on two HA instances then you will get 2 x 336 calls per day.

briis avatar Aug 20 '22 08:08 briis

Yeah. Understood. Running 1 instance only though...

Mariusthvdb avatar Aug 20 '22 11:08 Mariusthvdb

I also only had one location being used...and still hit the limit. I've increased my polling times and not had problems since then.

B-Kramer avatar Aug 20 '22 13:08 B-Kramer

well, Ive decreased the polling to 10 minutes, as explained above, and yet saw this:

2022-08-21 21:19:02.504 ERROR (MainThread) [custom_components.weatherbit] Error fetching weatherbit data: Error while retreiving data: Error requesting data from WeatherBit: 429, message='', url=URL('https://api.weatherbit.io/v2.0/current?lat=<lat>&lon=<lon>&key=<key>&lang=en&units=M&include=alerts')
2022-08-21 21:23:17.437 ERROR (MainThread) [custom_components.weatherbit] Error fetching weatherbit data: Error while retreiving data: Error requesting data from WeatherBit: 429, message='', url=URL('https://api.weatherbit.io/v2.0/forecast/daily?lat=<lat>&lon=<lon>&key=<key>&lang=en&units=M')

other than this, I have a few template sensors involving weatherbit sensors but don't think that would cause any extra polling?

and I have 1 card in HA frontend:

type: entities
header:
  type: picture
  image: /local/weather/weatherbit.png
  tap_action:
    action: url
    url_path: !secret weatherio_api_url
  hold_action:
    action: call-service
    service: homeassistant.reload_config_entry
    service_data:
      entry_id: b31782708171df0556b76c520ce103ed

but that url is only activated on a tap. Which didnt happen.

On holding the card above, I just saw all of my sensors disappear into the unknown..... tapping revealed the reason:

{"status_code":429,"status_message":"Your request count (536) is over the allowed limit of 500 per day - Upgrade your key, or retry after 215.26666666667 minutes"}

Mariusthvdb avatar Aug 21 '22 20:08 Mariusthvdb

I haven't had any more problems, my settings are 10 and 45 for each of the sliders.

B-Kramer avatar Aug 21 '22 20:08 B-Kramer

wait, checking the integration again, it reveals that the slider has moved back to 5 minutes...

Schermafbeelding 2022-08-21 om 22 26 47

so this is odd in itself.

ofc, next to the fact that Bjarnes calculation for polling seems to no stick somehow, and my numbers are topping that in the default settings

Mariusthvdb avatar Aug 21 '22 20:08 Mariusthvdb

I've started getting this error the last couple of days. It appears that the free tier has been dropped to 50 calls per day.

digitalwolf avatar Oct 13 '22 12:10 digitalwolf

You are absolutely right - just checked the website. I made adjustments now to the minimum and maximum values of the updates, but honestly, this leaves this integration somewhat useless. I don't use it myself anymore, as I get my data elsewhere, and this does not encourage me to spend too much time on it.

Changes will be in 1.0.14, which I will put out soon.

I will make a post on the Community Forum also.

Thanks

briis avatar Oct 13 '22 14:10 briis

Yeah, pretty disappointing. Out of curiosity, what do you use as an alternative?

On Thu, Oct 13, 2022, 9:44 AM Bjarne Riis @.***> wrote:

You are absolutely right - just checked the website. I made adjustments now to the minimum and maximum values of the updates, but honestly, this leaves this integration somewhat useless. I don't use it myself anymore, as I get my data elsewhere, and this does not encourage me to spend too much time on it.

Changes will be in 1.0.14, which I will put out soon.

I will make a post on the Community Forum also.

Thanks

— Reply to this email directly, view it on GitHub https://github.com/briis/weatherbit/issues/73#issuecomment-1277730656, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMDZCCZGCIYH6HFDDALRCLWDAN4ZANCNFSM566UA55A . You are receiving this because you commented.Message ID: @.***>

B-Kramer avatar Oct 13 '22 20:10 B-Kramer

Also looking at an alternative. I have mine set to 30 Minutes and 120 Minutes for the Sensor and Forecast yet still go over the limit by 12PM...

Now to find another option...

louispires avatar Oct 14 '22 14:10 louispires

same here, since the last update i get to many requests

mine is set to 60 Minutes Sensor and 120 Minutes Forecast

{"status_code":429,"status_message":"Your request count (51) is over the allowed limit of 50 per day - Upgrade your key, or retry after 881.26666666667 minutes"}

Bloodpack avatar Oct 15 '22 09:10 Bloodpack

but honestly, this leaves this integration somewhat useless. I don't use it myself anymore, as I get my data elsewhere, and this does not encourage me to spend too much time on it.

really sorry to hear Bjarne, I was an avid user, so thank you for your efforts nonetheless!

btw, what are you using for the sun intensity Weatherbit offered us? I cant seem to find a replacement for that

Mariusthvdb avatar Oct 15 '22 09:10 Mariusthvdb

The alternative for me, is:

  • Forecast: my Tempest Weather Station, which produces an AI based Forecast very locally. It seems pretty accurate, but does not contain all the data I can get from Weatherbit. But enough for my needs.
  • Current data: I use a mixture of a local Davis Vantage Vue weather station, the Tempest station for UV and Solar and a Davis AirLink for Air Quality.

With the above I am covered for my needs, and as all these devices are local (Except for Forecast), I can pull data as often as I want. 😁

briis avatar Oct 15 '22 10:10 briis

@B-Kramer @louispires

i use now openweathermap with Platinum Weather Card by @makin-things from HACS

Short Card

Platinum Weather Card

Long Card

Platinum Weather Card Large

in openweathermap config you have to use onecall_daily to get the forecast for 7 days

openweathermap_config

Bloodpack avatar Oct 15 '22 12:10 Bloodpack

"i use now openweathermap with Platinum Weather Card by @Makin-Things from HACS"

The free openweathermap api doesn't seem to allow "onecall_daily" selection. I get an invalid api key error, but the key works on hourly selection. Also openweathermap doesn't provide solar radiation levels on the free api.

greg520820 avatar Oct 15 '22 21:10 greg520820

@greg520820

strange, i use onecall_daily and i use the free API

Bloodpack avatar Oct 15 '22 21:10 Bloodpack

The problem is discussed here: https://github.com/home-assistant/core/issues/78241. It could be that you are on an earlier version of HA. It appears to have started on 2022.9.x.

On Sat, Oct 15, 2022 at 5:39 PM Bloodpack @.***> wrote:

@greg520820 https://github.com/greg520820

strange, i use onecall_daily and i use the free API

— Reply to this email directly, view it on GitHub https://github.com/briis/weatherbit/issues/73#issuecomment-1279836809, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUMQW545HYTHHXDQAMMQ3GTWDMQC7ANCNFSM566UA55A . You are receiving this because you were mentioned.Message ID: @.***>

greg520820 avatar Oct 15 '22 22:10 greg520820

@greg520820

I have an very old API key possible they changed someting with new registrations

Here my Homeassistant versions

166587223084269303530221439039

Bloodpack avatar Oct 15 '22 22:10 Bloodpack

It appears the sensor call from the integration is counting as 2 calls by Weatherbit. Setting the sensor call at 60 minutes and the forecast update at 240 minutes the call count increases by 2 each hour. I'm finding the call usage by using https://api.weatherbit.io/v2.0/subscription/usage?key="API_KEY". I even set the forecast interval at 720 minutes and checked the call count after 5 hours and it was 10 instead of the expected 5.

Only thing I could find in the api was this statement " include=minutely,alerts (optional: Include a 1 hour / minutely forecast , and severe weather alert in the response)* *Counts as an extra request against quota."

I verified this is true by issuing a https://api.weatherbit.io/v2.0/current?lat=39.xxx&lon=--84.xxxx&key=xxxxxxx5258edb290xxxxd62&include=minutely and another without the "include=minutely" The first counted as 2 calls the last as 1 call. So maybe the integration is requesting the severe weather alert and that is counting as another call.

Is there a way to modify the code so it doesn't request the severe weather alert to see if this is the issue?

I would really like to get 1 hour sensor updates and 6 hour forecast interval, which should only be 28 calls, well within the 50 limit. I get severe weather alerts from another source (NWS).

Any help would be appreciated.

greg520820 avatar Oct 17 '22 21:10 greg520820

Thanks @greg520820 for checking this. I was not aware that adding the alert would generate an extra call - here we go, maybe I should be more carefully in reading the docs 😁 Yes I could remove the automatic Weather Alert pull, it is a simple operation. But I would then have to add some extra config options for the people who want the Alerts, with the extra call this makes. Let me see what I can do over the weekend.

briis avatar Oct 18 '22 05:10 briis

Thanks for looking at this. I've tried to find another source for similar information, but 16 days of daily forecasts with a full compliment of sensors, especially the solar radiation sensor, doesn't seem to exist. Your integration is great at pulling and presenting the data.

I will say that weather alert information is available from many sources, but being able to select if you wanted alert information would be ideal.

greg520820 avatar Oct 18 '22 14:10 greg520820

Making the Alert pull selectable will certainly help with the 50 call limit. I tried to understand the code and the Alert pull seems to be hard-coded in the pyWeatherbitdata module? So I was not able to remove the Alert pull to checkout it out. According to Weatherbit most stations only update sensors every 15 to 30 minutes and forecasts every hour. So very short update intervals for the integration are often just pulling the same information from Weatherbit.

To evaluate the number of pulls I setup another free Weatherbit key using another email address. Not sure this would even be possible, but could the code be modified to allow two keys to be entered. Use one key for 50 pulls and then switch to second key? Or use the key until the "too many pulls error" was returned and then switch to other key. This would allow sensors, forecasts, and alerts to be retrieved with reasonably intervals.

greg520820 avatar Oct 21 '22 00:10 greg520820

if I would only use this for irradiance.... would that be possible at all, and stay within limits? Dont need the forecasts, or alerts. As Bjarne said, those can be had elsewhere. I havent found the irradiation however. and, ofc, that must be update at least hourly during the day

Mariusthvdb avatar Oct 21 '22 09:10 Mariusthvdb