Pirate-Weather / pirate-weather-ha

Replacement for the default Dark Sky Home Assistant integration using Pirate Weather
https://pirateweather.net/
Apache License 2.0
354 stars 23 forks source link

Hits the limit after 6 hours #230

Closed alpha520098 closed 2 weeks ago

alpha520098 commented 4 months ago

Describe the issue

So i got the storm distance and bearing to work (thank you)

however the API limit is being exhausted with in 6 hours, ive got the refresh to 1200

Acknowledgements

cloneofghosts commented 4 months ago

From the looks of things you're using the HA integration no? Someone else was having a similar situation #221 and it turns out the cause was having more than one integration setup and the key was marked as untrustworthy so it was being blocked.

I'll also ping @alexander0042 to look into things on his end to see if he can figure anything out.

alexander0042 commented 4 months ago

Thanks for reaching out! I'll second what @cloneofghosts said, could you clarify if you're using the HA integration or some other way to call the API?

alpha520098 commented 4 months ago

@alexander0042 and @cloneofghosts - Good morning gents, so I am using HA intergation, I have deleted all the other API and using just the one.

I have found however if i only select the storm distance and bearing it seems to last long rather then the entire amount of sensors.

Also just another question in terms of the storm distance, is this measuring the storm from the location GPS from my location?

cloneofghosts commented 4 months ago

Thanks for confirming that you're using the HA integration. Just for clarification you're still having issues with hitting the API limit or has it been solved? If you're still having issues do you have more than one instance of the integration setup? The update rate you have it set to shouldn't cause any issues with hitting the API limit that quickly and having other weather integrations shouldn't affect anything either.

I have found however if i only select the storm distance and bearing it seems to last long rather then the entire amount of sensors.

Can you clarify what you mean by this? I'm not really sure what exactly you are trying to say here.

cloneofghosts commented 3 months ago

Hi @alpha520098 are you still having issues with the API limit or has it sorted itself out? If you are still having issues with the API limit could you supply the email you signed up with or email api@pirateweather.net and @alexander0042 can look into this for you.

alpha520098 commented 3 months ago

@cloneofghosts, Hi and thanks for checking in. Yes, I’ve subscribed to the $2 per month plan, and it seems to have settled things down.

On a side note, I wrote some code that analyzes the bearing and distance to create distance rings at 10, 20, 50, and 100 km intervals in all directions. This includes the names of areas and suburbs to provide context on the storm's location, using my home as a reference point.

for anyone else that is reading this make a template sensor Screenshot 2024-06-04 085253

my many thanks to @alexander0042 and @cloneofghosts for making this intergation

cloneofghosts commented 3 months ago

Alright, good to know. I'll close this for now but feel free to re-open if you're having issues with hitting the limit in the future.

alpha520098 commented 2 months ago

hey @alexander0042 so i've seen the excellent work that you've done and i have paid for the subsribtion but I hit the limit again i do note its been over 2 weeks but i thought that this would have solved this issue, any chance you could have a look at this?

alexander0042 commented 2 months ago

On it!

alexander0042 commented 2 months ago

Sorry for the short update followed by silence, it is a weird issue! I checked a couple things, but nothing immediately jumped out.

Can you confirm if you subscribed on Apiable and what your e-mail address was (you can redact part of it if you'd like)? I've got a plan to figure this out once and for all, but first I need to extend your subscription so calls start working again

LeonardoGandini commented 2 months ago

Hi @alexander0042 just want to add that this is happening to my HA as well.Error communicating with API: 429, message='Too Many Requests', url=URL('https://api.pirateweather.net/forecast/API_KEY/44.8,9.2units=si&extend=hourly&version=2') in this HA I have 6 PW entries, different coordinates. I have PW on 3 different HA installations and never had an issue for months, now on just one, this is happening. I was planning to finally upgrade my PW subscription then I saw @alpha520098 message. If you need extra info let me know

alexander0042 commented 2 months ago

Hi @LeonardoGandini, thanks for helping to debug this issue! Just to confirm, you have 6 different locations configured, and do you know if you changed the update interval from the default? At the default 20 minute update interval, I believe that would exceed the 10,000 base limit which might explain this?

alexander0042 commented 2 months ago

Also, in the meantime I upped your request limit, so you should see things start working again!

LeonardoGandini commented 2 months ago

Thanks it's working now. I didn't change the default settings I don't think 🤔 Is there a way to check how many requests are going from HA and/or reconfigure the integration interval without adding a new one?

alexander0042 commented 2 months ago

If you turn on "debug logging" you should see something in your logs every time there's a new update. Default is 20 minutes, which should be enough for up to four different locations

LeonardoGandini commented 2 months ago

got it, apologies I might just be dumb, is there a way to change the scan_interval without removing and adding an Entry again? I will upgrade my subscr anyway, as I'm planning to add other locations.

alexander0042 commented 2 months ago

Not a dumb question at all! I really wish there was, but I can't figure out how to update an existing data coordinator once it's been created in Home Assistant (same problem with changing locations).

jhemak commented 2 months ago

@alexander0042 - perhaps you know this and know better than to try it. But once upon a time, I was able to find the integration in config\.storage\core.config_entries, edited scan_interval, rebooted, and was good to go. But, be careful not to mess up the file!

cloneofghosts commented 2 weeks ago

As of V1.5.5 you can now edit the scan_interval in the integration configuration even after you've setup the integration.