New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AirVisual making too many requests. #42776
Comments
This issue report needs more information to be actionable – specifically:
|
airvisual documentation |
Same thing happened to me. Testing API with curl returns I'm not sure how to find DEBUG-level logs, can you share details? |
all sensors showing unavailable since a couple of days, not sure if this coincided with updating to HA 117.x. This is all we get, I have but 1 instance configured: added to the error in the issue above, this is shown in the logs for all sensors:
more logs:
airvisual dashboard on https://www.iqair.com/dashboard/api: |
|
I just removed the integration hoping to be able to recover it by re-configuring it but it didn't work. I'm nuw unable to configure it again because of the limit error. Logger: aiohttp.server Error handling request
Just one. (Ehm, actually 0 at the present moment.)
|
I am also getting this for one or two days now. I have 2 instances with the same API. It's only this error on repeat in my case 2020-11-03 10:52:34 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 119, in _handle_refresh_interval await self.async_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 193, in async_refresh update_callback()
File "/usr/src/homeassistant/homeassistant/components/airvisual/__init__.py", line 414, in update self.update_from_latest_data()
File "/usr/src/homeassistant/homeassistant/components/airvisual/sensor.py", line 168, in update_from_latest_data data = self.coordinator.data["current"]["pollution"]
TypeError: 'NoneType' object is not subscriptable
2020-11-03 10:52:35 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 119, in _handle_refresh_interval await self.async_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 193, in async_refresh update_callback()
File "/usr/src/homeassistant/homeassistant/components/airvisual/__init__.py", line 414, in update self.update_from_latest_data()
File "/usr/src/homeassistant/homeassistant/components/airvisual/sensor.py", line 168, in update_from_latest_data data = self.coordinator.data["current"]["pollution"]
TypeError: 'NoneType' object is not subscriptable |
All keys stopped counting at 502 calls... Anyhow, the entities in HA are never available... |
Thanks for the info, all. The code that handles the update interval has remained consistent for some time... The fact that everyone is experiencing this at the same time makes me think that either (a) the API limit has changed or (b) the API had some sort of glitch (especially since multiple people were showing that 502 number in their dashboard). I've regenerated my own key and things are working fine. I'm going to keep an eye on it to see if it happens again; if it does and I haven't reached the limit stipulated by their documentation, I'll reach out to them. |
@bachya thanks for the tip! I can confirm that recreating the API key solved the problem. |
I just ran into this again after upgrading to 0.117.3:
My AirVisual dashboard once again shows the 502 value: I'll reach out to AirVisual and see if they can help me understand what's going on. |
Submitted a helpdesk ticket to AirVisual; they said it may be up to two business days before I hear back. |
Same here. |
let's hope, because the newly created Api key has worked for exactly 1 day ....... hit the same error once again just now. gr.. |
My integration has started (magically) reporting again – anyone else? |
hi Aaron, i can confirm it's fine for now, using 117.4 |
Yes, mines has started working today as well! |
Yes same for me as well. Guess they messed up their API and had to fix it. |
Yeah same here. Don't know how long since it's back but I see it's working now again. |
Great to hear, all. I've yet to hear back from AirVisual, but since this started working with no code change, I'm going to chalk it up to an upstream bug and close this issue. I'll post back if AirVisual gets back to me. |
I have some bad news. Unavailable for an hour now and checking the API it's at 501 calls. Seems like the magic faded away |
I can confirm the same for me 😢 |
Yeah... Someone claimed victory a bit too early here. |
Yup went down for me today also |
Confirming same problem here as of today (and earlier in the week), 502 daily calls reported in the AIrVisual API dashboard. Debug logging from the component shows 280 calls so far today (roughly what I would expect for 5 minute updates). |
Same issue for me using 0.117.5 :( |
Same for me |
Super-quick fix if you don't want to wait.
This is a bodge; there are surely shortcuts and errors but for the moment it works on my config, so I am happy with this. I did my best; I am sure that my code will be gross to watch for some of the experienced chaps in here and I am open to suggestions! I left my Location and Stations of interest in, so for you to quickly try the config with a working configuration; change it accordingly to your location. In the declaration of |
Heard back from IQAir today:
My response:
Will keep everyone posted as I hear more. |
Thanks Aaron, If i understand correctly they say: "[...]We didn’t change the call limits which are still as below.[...] but in fact their limits were allowing: Sadly, I cannot quickly find any such reference to 1000/day in their documentation. So either they accept to increase back to 1000/day, which i doubt... |
Same issue on 0.117.5 |
Something doesn't add up here, If there are too many requests then it should work for a period of time until we hit their limit but it doesn't work at all at any time of the day. It worked for a day or so then stopped again and zero changes were made by @bachya which makes me think that it is something they have/are doing with their API. |
I think we should give them the benefit of the doubt. |
@Ndrinta If that was the case how come a new API key works for a day or so before exhibiting the same issue ? It must be something they are doing IMO. **** OK I see where you are coming from - they are blacklisting any new key after a certain period **** |
I thought about that, too. It's true but they might put the key in the blacklist rather then your IP. I know it doesn't make 100% sense but I simply have no idea... just thinking out loud. **** Yep, but I have no way to prove it **** |
@Ndrinta I agree - based on my observations as well, the api calls are successful as long as they are within the API limit. When limit crossed, the key is blacklisted and no option to restore it from this state - but only to generate new one. |
I couldn't find the reference too, probably that number was found on a post or topic being corrected now.
Refer above.
Totally agree, but I would argue the user should have a finer control over the update interval, as I said in a previous comment. |
I've just heard back from IQAir. Just like @bachya, they told me that with my previous API-key I had gone above the 500 calls a day limit. They couldn't tell me the effective number of calls I had done because the API-key does not exist anymore. I'm now running with a new API-key. It stopped working again tonight ~1AM with the same error (data: Error while retrieving data: call_per_day_limit_reached) and started again on it's own at ~11AM. I think giving the number of people having this issue after upgrading to 0.117.X and the lack of mentions for issues in previous versions, I'm prone to think it's something on our side too, at least partially... I have now set the log to DEBUG-level. |
yep, back in business. didnt change a thing ;-) |
@BertrumUK mine started as well working at 12:40, now it;s 17:30, and i see in the APi dashboard that i've made 58 calls so far - so 12 calls per hour, one every 5 minutes. I guess some issue on their side after all ?
@Ndrinta Indeed, it makes sense... |
Currently on 64 calls for the day so are we going to get a repeat of a few days ago where it started to work again then it failed or have they actually fixed something this time ? Time will tell. |
I think there's something going on on their end. The most frequent API ping interval used by the HASS integration is 1 call per 4.7 minutes (based on a monthly calculation); that amounts to 304 calls per day, which is well under the represented daily limit. |
Just received this answer from IQAir:
You might be right after all. |
I got the same message:
Let's leave this issue open until the end of the week; if everyone is looking good, we'll close. @Ndrinta To answer your question:
...you can do something like this in your logger:
default: info
logs:
homeassistant.components.airvisual: debug |
Looks like we're good now! Finally... Closing this. Cheers to all! |
Here we go again: "Unavailable" everywhere. |
sorry to hear, mine is working so far, last update received 34 minutes ago... |
How many integrations of AirVisual have you got? If I may. |
Ok, I've got 2. That might be one of the differences. |
and 166 calls today till now |
The problem
Error while retrieving data: call_per_day_limit_reached
Environment
Problem-relevant
Traceback/Error logs
Additional information
The integration stops working after breaking the limit of 500 calls a day.
The text was updated successfully, but these errors were encountered: