core: AirVisual making too many requests.
The problem
Error while retrieving data: call_per_day_limit_reached
Environment
- Home Assistant Core release with the issue: First time noticed on 0.117.X
- Last working Home Assistant Core release (if known): Probably working on 0.116.X
- Operating environment (OS/Container/Supervised/Core): OS [VM]
- Integration causing this issue: AirVisual (API)
- Link to integration documentation on our website: AirVisual
Problem-relevant
Traceback/Error logs
Logger: homeassistant.components.airvisual
Source: helpers/update_coordinator.py:166
Integration: AirVisual (documentation, issues)
First occurred: 10:42:59 PM (2 occurrences)
Last logged: 10:47:44 PM
Error fetching XX.XXX, XX.XXX data: **Error while retrieving data: call_per_day_limit_reached**
Additional information
The integration stops working after breaking the limit of 500 calls a day.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 55 (16 by maintainers)
Yeah… Someone claimed victory a bit too early here. Of course it was working this morning, it was a new day, thus, the counter started from 0 again… I raised a ticket with AirVisual on day 0 (5 days ago) but no answer yet. I think we should accept the fact that they might have decided to reduce the number of calls to 500 a day and consequentially either allow the user to set a custom
interval_timeor to patch the code.Heard back from IQAir today:
My response:
Will keep everyone posted as I hear more.
Submitted a helpdesk ticket to AirVisual; they said it may be up to two business days before I hear back.
All keys stopped counting at 502 calls… Anyhow, the entities in HA are never available…
Can confirm the same error, 117.1 and 117.2, entities are unavailable, the API key looks ok.
Tried to reload the AirVisual integration, no effect. Probably some failsafe threshold was added in place at HA, before reaching the airvisual?
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. Now I get this error, which is basically the same error, just in a different shape.
Logger: aiohttp.server Source: components/airvisual/config_flow.py:129 First occurred: November 2, 2020, 10:48:51 PM (4 occurrences) Last logged: 10:21:49 AM
Error handling request Traceback (most recent call last): File “/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py”, line 418, in start resp = await task File “/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py”, line 458, in _handle resp = await handler(request) File “/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py”, line 119, in impl return await handler(request) File “/usr/src/homeassistant/homeassistant/components/http/request_context.py”, line 18, in request_context_middleware return await handler(request) File “/usr/src/homeassistant/homeassistant/components/http/ban.py”, line 72, in ban_middleware return await handler(request) File “/usr/src/homeassistant/homeassistant/components/http/auth.py”, line 127, in auth_middleware return await handler(request) File “/usr/src/homeassistant/homeassistant/components/http/view.py”, line 129, in handle result = await result File “/usr/src/homeassistant/homeassistant/components/config/config_entries.py”, line 169, in post return await super().post(request, flow_id) File “/usr/src/homeassistant/homeassistant/components/http/data_validator.py”, line 60, in wrapper result = await method(view, request, *args, **kwargs) File “/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py”, line 106, in post result = await self._flow_mgr.async_configure(flow_id, data) File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 153, in async_configure result = await self._async_handle_step(flow, cur_step[“step_id”], user_input) File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 201, in _async_handle_step result: Dict = await getattr(flow, method)(user_input) File “/usr/src/homeassistant/homeassistant/components/airvisual/config_flow.py”, line 110, in async_step_geography return await self.async_step_geography_finish( File “/usr/src/homeassistant/homeassistant/components/airvisual/config_flow.py”, line 129, in async_step_geography_finish await cloud_api.air_quality.nearest_city() File “/usr/local/lib/python3.8/site-packages/pyairvisual/air_quality.py”, line 39, in nearest_city return await self._nearest(“city”, latitude, longitude) File “/usr/local/lib/python3.8/site-packages/pyairvisual/air_quality.py”, line 23, in _nearest data: dict = await self.request(“get”, f"nearest{kind}", params=params) File “/usr/local/lib/python3.8/site-packages/pyairvisual/cloud_api.py”, line 71, in _request raise_on_data_error(data) File “/usr/local/lib/python3.8/site-packages/pyairvisual/errors.py”, line 81, in raise_on_data_error raise error(message) pyairvisual.errors.AirVisualError: call_per_day_limit_reached
Just one. (Ehm, actually 0 at the present moment.)
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 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
configuration.yaml: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.
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.
let’s hope, because the newly created Api key has worked for exactly 1 day … hit the same error once again just now. gr…
Same here. On 0.117.4
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
use this to set debug level: