Skip to content
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

Closed
Ndrinta opened this issue Nov 2, 2020 · 55 comments
Closed

AirVisual making too many requests. #42776

Ndrinta opened this issue Nov 2, 2020 · 55 comments

Comments

@Ndrinta
Copy link

Ndrinta commented Nov 2, 2020

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.

@bachya
Copy link
Contributor

bachya commented Nov 2, 2020

This issue report needs more information to be actionable – specifically:

  • What do DEBUG-level logs for AirVisual say?
  • How many instances of the AirVisual API are configured?
  • How many calls does your AirVisual API dashboard show? How does that number increase in a 5-to-10-minute span?

@probot-home-assistant
Copy link

airvisual documentation
airvisual source
(message by IssueLinks)

@AmadeusW
Copy link

AmadeusW commented Nov 3, 2020

Same thing happened to me. Testing API with curl returns {"status":"fail","data":{"message":"call_per_day_limit_reached"}}

I'm not sure how to find DEBUG-level logs, can you share details?
I have one instance of AirVisual API
The dashboard shows 502 requests in both a day and in a month.

@Mariusthvdb
Copy link
Contributor

Mariusthvdb commented Nov 3, 2020

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:

Schermafbeelding 2020-11-03 om 10 19 02

added to the error in the issue above, this is shown in the logs for all sensors:

2020-11-03 10:15:35 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform airvisual
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 314, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 505, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 530, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/airvisual/__init__.py", line 419, in async_added_to_hass
    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

more logs:

2020-11-03 10:23:44 DEBUG (MainThread) [homeassistant.components.airvisual] Leveling API key usage (6redacted5): 1 consumers, 5 minutes between updates
2020-11-03 10:23:44 DEBUG (MainThread) [homeassistant.components.airvisual] Updating interval for coordinator: {long/lat redacted}, 0:05:00
2020-11-03 10:23:45 ERROR (MainThread) [homeassistant.components.airvisual] Error fetching {long/lat redacted} data: Error while retrieving data: call_per_day_limit_reached
2020-11-03 10:23:45 DEBUG (MainThread) [homeassistant.components.airvisual] Finished fetching {long/lat redacted} data in 1.078 seconds
2020-11-03 10:23:45 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform airvisual
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 314, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 505, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 530, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/airvisual/__init__.py", line 419, in async_added_to_hass
    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:23:45 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up airvisual platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 205, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 314, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 505, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 530, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/airvisual/__init__.py", line 419, in async_added_to_hass
    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:23:45 DEBUG (MainThread) [homeassistant.components.airvisual] Finished fetching {long/lat redacted} data in 0.321 seconds
2020-11-03 10:23:45 ERROR (MainThread) [homeassistant.components.sensor] airvisual: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 357, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 466, in async_device_update
    await task
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 235, in async_update
    await self.coordinator.async_request_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 126, in async_request_refresh
    await self._debounced_refresh.async_call()
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 73, in async_call
    await self.hass.async_add_hass_job(self._job)  # type: ignore
  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

airvisual dashboard on https://www.iqair.com/dashboard/api:

Schermafbeelding 2020-11-03 om 10 31 23

@Mariusthvdb
Copy link
Contributor

Same thing happened to me. Testing API with curl returns {"status":"fail","data":{"message":"call_per_day_limit_reached"}}

I'm not sure how to find DEBUG-level logs, can you share details?
I have one instance of AirVisual API
The dashboard shows 502 requests in both a day and in a month.

use this to set debug level:
Schermafbeelding 2020-11-03 om 10 27 18

@Ndrinta
Copy link
Author

Ndrinta commented Nov 3, 2020

This issue report needs more information to be actionable – specifically:

  • What do DEBUG-level logs for AirVisual say?

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

  • How many instances of the AirVisual API are configured?

Just one. (Ehm, actually 0 at the present moment.)

  • How many calls does your AirVisual API dashboard show? How does that number increase in a 5-to-10-minute span?

Screenshot_20201103-102125
Unable to tell because the Integration stopped working...

@drthanwho
Copy link
Contributor

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

@alexciurea
Copy link

Can confirm the same error, 117.1 and 117.2, entities are unavailable, the API key looks ok.

image

Tried to reload the AirVisual integration, no effect.
Probably some failsafe threshold was added in place at HA, before reaching the airvisual?

@alexciurea
Copy link

All keys stopped counting at 502 calls... Anyhow, the entities in HA are never available...

@bachya
Copy link
Contributor

bachya commented Nov 3, 2020

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.

@alexciurea
Copy link

@bachya thanks for the tip! I can confirm that recreating the API key solved the problem.
Similar issue happened in the past, and was resolved by API key recreation - but at that time the entities did not become unavailable, simply were not getting updated...

@bachya
Copy link
Contributor

bachya commented Nov 4, 2020

I just ran into this again after upgrading to 0.117.3:

Log Details (ERROR)


Logger: homeassistant.components.airvisual
Source: helpers/update_coordinator.py:166 
Integration: AirVisual (documentation, issues) 
First occurred: 7:44:56 AM (1 occurrences) 
Last logged: 7:44:56 AM

Error fetching REDACTED, REDACTED data: Error while retrieving data: call_per_day_limit_reached

My AirVisual dashboard once again shows the 502 value:

image

I'll reach out to AirVisual and see if they can help me understand what's going on.

@bachya
Copy link
Contributor

bachya commented Nov 4, 2020

Submitted a helpdesk ticket to AirVisual; they said it may be up to two business days before I hear back.

@silviudc
Copy link

silviudc commented Nov 5, 2020

Same here.
On 0.117.4

@Mariusthvdb
Copy link
Contributor

Mariusthvdb commented Nov 5, 2020

let's hope, because the newly created Api key has worked for exactly 1 day ....... hit the same error once again just now. gr..

@bachya
Copy link
Contributor

bachya commented Nov 6, 2020

My integration has started (magically) reporting again – anyone else?

@alexciurea
Copy link

hi Aaron, i can confirm it's fine for now, using 117.4

@ohheyrj
Copy link

ohheyrj commented Nov 6, 2020

Yes, mines has started working today as well!

@BertrumUK
Copy link

Yes same for me as well. Guess they messed up their API and had to fix it.

@drthanwho
Copy link
Contributor

Yeah same here. Don't know how long since it's back but I see it's working now again.

@bachya
Copy link
Contributor

bachya commented Nov 6, 2020

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.

@drthanwho
Copy link
Contributor

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

@BertrumUK
Copy link

I can confirm the same for me 😢

@Ndrinta
Copy link
Author

Ndrinta commented Nov 7, 2020

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_time or to patch the code.

@silviudc
Copy link

silviudc commented Nov 7, 2020

Yup went down for me today also

@axxelh
Copy link

axxelh commented Nov 8, 2020

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).

@blackskull182
Copy link

Same issue for me using 0.117.5 :(

@majkers
Copy link

majkers commented Nov 9, 2020

Same for me

@Ndrinta
Copy link
Author

Ndrinta commented Nov 9, 2020

Super-quick fix if you don't want to wait.
These sensors make WAQI compatible with AirVisual Card.

# === Sensors
sensor:

    # World Air Quality Index (WAQI) - [https://www.home-assistant.io/integrations/waqi/]
  - platform: waqi
    token: !secret waqi_api_key
    locations:
      - Coventry # YOUR_LOCATION
    stations: 
      - "Coventry Allesley, United Kingdom" # STATION_OF_INTEREST_1
      - "Coventry Memorial Park, United Kingdom" # STATION_OF_INTEREST_2

    # Pollution Level (from WAQI)
  - platform: template
    sensors:
      waqi_air_pollution_level:
        friendly_name: WAQI Pollution Level
        value_template: >-
          {% set level = ((states('sensor.waqi_coventry_allesley_united_kingdom')|int + states('sensor.waqi_coventry_memorial_park_united_kingdom')|int) / 2 )|int %}
          {% if level <= 50 %}
            Good
          {% elif level <= 100 %}
            Moderate
          {% elif level <= 200 %}
            Unhealty
          {% elif level <= 300 %}
            Very Unhealty
          {% else %}
            Hazardous
          {% endif %}
        icon_template: >-
          {% set level = ((states('sensor.waqi_coventry_allesley_united_kingdom')|int + states('sensor.waqi_coventry_memorial_park_united_kingdom')|int) / 2 )|int %}
          {% if level <= 50 %}
            mdi:emoticon-excited
          {% elif level <= 100 %}
            mdi:emoticon-happy
          {% elif level <= 150 %}
            mdi:emoticon-neutral
          {% elif level <= 200 %}
            mdi:emoticon-sad
          {% elif level <= 300 %}
            mdi:emoticon-dead
          {% else %}
            mdi:biohazard
          {% endif %}
#        attribute_templates:
#          latitude:  >-
#            {{ state_attr('sensor.u_s_air_pollution_level','latitude') }}
#          longitude:  >-
#            {{ state_attr('sensor.u_s_air_pollution_level','longitude') }}

    # Quality Index (from WAQI)
  - platform: template
    sensors:
      waqi_air_quality_index:
        friendly_name: WAQI Quality Index
        value_template: >-
          {{ ((states('sensor.waqi_coventry_allesley_united_kingdom')|int + states('sensor.waqi_coventry_memorial_park_united_kingdom')|int) / 2 )|int}}
        unit_of_measurement: 'AQI'
          
    # Main Pollutant (from WAQI)
  - platform: template
    sensors:
      waqi_main_pollutant:
        friendly_name: WAQI Main Pollutant
        value_template: >-
          {% set main_pollutant = state_attr('sensor.waqi_coventry_allesley_united_kingdom','dominentpol') %}
          {% if main_pollutant == "pm25" %}
            PM2.5
          {% elif main_pollutant == "pm10" %}
            PM10
          {% elif main_pollutant == "o3" %}
            Ozone
          {% elif main_pollutant == "no2" %}
            Nitrogen Dioxide
          {% elif main_pollutant == "so2" %}
            Sulfur Dioxide
          {% else %}
            Unknown
          {% endif %}
        attribute_templates:
          pollutant_unit: >-
            {% set main_pollutant = state_attr('sensor.waqi_coventry_allesley_united_kingdom','dominentpol') %}
            {% if main_pollutant == "pm25" %}
              µg/m³
            {% elif main_pollutant == "pm10" %}
              µg/m³
            {% elif main_pollutant == "o3" %}
              ppb
            {% elif main_pollutant == "no2" %}
              ppb
            {% elif main_pollutant == "so2" %}
              ppb
            {% else %}
              Unknown
            {% endif %}

    # Outside Temperature (from WAQI)
  - platform: template
    sensors:
      waqi_temperature:
        friendly_name: WAQI Temperature
        unit_of_measurement: '°C'
        value_template: >-
          {{ state_attr('sensor.waqi_coventry_allesley_united_kingdom','temperature') }}
        device_class: temperature

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.
I decided to select those 2 stations because (in my specific case) the integration populates a 3rd sensor which is not of interest (somewhere in US I think), and I thought it was a waste of resources.
I chose to make the average of the 2 sensors (for a try) but to take in consideration only the closest station for the main pollutant.

In the declaration of sensor.waqi_air_pollution_level, the attributes latitude and longitude are commented out. This because I found out these are not strictly necessary for the functionality of AirVisual Card.

@bachya
Copy link
Contributor

bachya commented Nov 9, 2020

Heard back from IQAir today:

Hi Aaron,

We cannot check the API call amount in previous months. In November, you made 607 calls this month by far and 105 calls today. We didn’t change the call limits which are still as below. We can check again at the end of this month to see how many calls they make in a month in total. At the same time, if they see the error message again, they can send us a screenshot for troubleshooting. Thanks.

/Minute: 5
/Day: 500
/Month: 10,000

Best regards,

Edgar

My response:

Hello Edgar,

Thank you for the reply. Despite the numbers you reflect below (which are below the limits), even this morning, I am still receiving “call_per_day_limit_reached” responses from the API.

Will keep everyone posted as I hear more.

@alexciurea
Copy link

Thanks Aaron,

If i understand correctly they say:

"[...]We didn’t change the call limits which are still as below.[...]
/Minute: 5
/Day: 500
/Month: 10,000"

but in fact their limits were allowing:
/Minute: 5
/Day: 1000
/Month: 10,000"

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...
Or the calls from home assistant are halved to fit in this reduced constraint... (e.g. call once in 10 minutes instead of once in 5 minutes).

@mrfoxbit
Copy link

Same issue on 0.117.5

@BertrumUK
Copy link

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.

@Ndrinta
Copy link
Author

Ndrinta commented Nov 10, 2020

I think we should give them the benefit of the doubt.
If the integration is now, for some reason, broken and it's making, say, thousands of requests, their end would probably protect itself putting us in a sort of black list.

@BertrumUK
Copy link

BertrumUK commented Nov 10, 2020

@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 ****

@Ndrinta
Copy link
Author

Ndrinta commented Nov 10, 2020

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 ****

@alexciurea
Copy link

@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.

@Ndrinta
Copy link
Author

Ndrinta commented Nov 10, 2020

Sadly, I cannot quickly find any such reference to 1000/day in their documentation.

I couldn't find the reference too, probably that number was found on a post or topic being corrected now.
I think they are right and if you do the math 500 makes sense. I think they never decreased the limit from 1000 to 500, it was always 500. The API "Updated every 5 minutes" so up to 288 times per day or 8928 a months (31 days), arguably, there would be no point on increasing that 500 further. It is possible that we just made that '1000' up without referring to the original documentation... Here you have demonstrated the importance of citing sources, I guess.

So either they accept to increase back to 1000/day, which i doubt...

Refer above.

Or the calls from home assistant are halved to fit in this reduced constraint... (e.g. call once in 10 minutes instead of once in 5 minutes).

Totally agree, but I would argue the user should have a finer control over the update interval, as I said in a previous comment.

@Ndrinta
Copy link
Author

Ndrinta commented Nov 10, 2020

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.

image

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.

@BertrumUK
Copy link

BertrumUK commented Nov 10, 2020

Mine started working again 47 minutes (approx 13.30 UTC) with no intervention from myself. Anyone else ?

Checking my API and showing 53 calls when it has been broken for days

image

@Mariusthvdb
Copy link
Contributor

yep, back in business. didnt change a thing ;-)

@alexciurea
Copy link

alexciurea commented Nov 10, 2020

Mine started working again 47 minutes (approx. 13.30 UTC) with no intervention from myself. Anyone else ?

@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 ?

I couldn't find the reference too, probably that number was found on a post or topic being corrected now.
I think they are right and if you do the math 500 makes sense. I think they never decreased the limit from 1000 to 500, it was always 500. The API "Updated every 5 minutes" so up to 288 times per day or 8928 a months (31 days), arguably, there would be no point on increasing that 500 further. It is possible that we just made that '1000' up without referring to the original documentation... Here you have demonstrated the importance of citing sources, I guess.

@Ndrinta Indeed, it makes sense...

@BertrumUK
Copy link

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.

@bachya
Copy link
Contributor

bachya commented Nov 10, 2020

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.

@Ndrinta
Copy link
Author

Ndrinta commented Nov 11, 2020

Just received this answer from IQAir:

We have fixed this API limit issue. Can you please check again and let us know if you still receive any error message?
Thanks for your support and the patience.

You might be right after all.
Do you know if there is a way to check when every single call is made by the integration? Should I set a deeper log level?

@bachya
Copy link
Contributor

bachya commented Nov 11, 2020

I got the same message:

This API call limit issue has been fixed. Please try again and let us know if there is any further questions.

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:

Do you know if there is a way to check when every single call is made by the integration? Should I set a deeper log level?

...you can do something like this in your configuration.yaml:

logger:
  default: info
  logs:
    homeassistant.components.airvisual: debug

@Ndrinta
Copy link
Author

Ndrinta commented Nov 13, 2020

Looks like we're good now! Finally... Closing this. Cheers to all!

@Ndrinta Ndrinta closed this as completed Nov 13, 2020
@Ndrinta
Copy link
Author

Ndrinta commented Nov 16, 2020

Here we go again: "Unavailable" everywhere.
Anyone else?

@alexciurea
Copy link

sorry to hear, mine is working so far, last update received 34 minutes ago...

@Ndrinta
Copy link
Author

Ndrinta commented Nov 16, 2020

How many integrations of AirVisual have you got? If I may.

@alexciurea
Copy link

only one, and it creates 6 entities

image

@Ndrinta
Copy link
Author

Ndrinta commented Nov 16, 2020

Ok, I've got 2. That might be one of the differences.

@alexciurea
Copy link

and 166 calls today till now

@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests