Core: Airvisual call_per_month_limit_reached

Created on 27 Apr 2020  Â·  21Comments  Â·  Source: home-assistant/core

The problem


The AirVisual component/integration used to support the scan_interval setting. I used to use that setting to set my scan interval to a high value as to not reach my api call limit since I'm monitoring 3 locations/geographies. Without the scan_interval setting I'm now getting this error:

hass    | 2020-04-27 18:30:07 ERROR (MainThread) [homeassistant.components.airvisual] Error while retrieving data: call_per_month_limit_reached
hass    | 2020-04-27 18:30:07 ERROR (MainThread) [homeassistant.components.airvisual] Error while retrieving data: call_per_month_limit_reached
hass    | 2020-04-27 18:30:07 ERROR (MainThread) [homeassistant.components.airvisual] Error while retrieving data: call_per_month_limit_reached

It appears that the airvisual component makes one api call per location/geography and now doesn't allow me to reduce the frequency at which it makes those calls, thus causing me to hit a limit.

The PR that removed the scan_interval is #32072 and it's also mentioned in #33182.

Environment

  • Home Assistant Core release with the issue: 0.108.6
  • Last working Home Assistant Core release (if known):
  • Operating environment (Home Assistant/Supervised/Docker/venv): Custom docker with venv
  • Integration causing this issue: airvisual
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/airvisual/

Screen Shot 2020-04-27 at 11 41 10 AM

Problem-relevant configuration.yaml

airvisual:
  api_key: !secret airvisual_key
  geographies:
    - <<: &airvisual
        country: usa
        state: california
      city: blackhawk
    - <<: *airvisual
      city: concord
    - <<: *airvisual
      city: livermore

Traceback/Error logs

hass    | 2020-04-27 18:30:07 ERROR (MainThread) [homeassistant.components.airvisual] Error while retrieving data: call_per_month_limit_reached
hass    | 2020-04-27 18:30:07 ERROR (MainThread) [homeassistant.components.airvisual] Error while retrieving data: call_per_month_limit_reached
hass    | 2020-04-27 18:30:07 ERROR (MainThread) [homeassistant.components.airvisual] Error while retrieving data: call_per_month_limit_reached

Additional information

airvisual

Most helpful comment

I've found the issue – fix forthcoming and will get it into 0.110.4.

All 21 comments

Hey there @bachya, mind taking a look at this issue as its been labeled with a integration (airvisual) you are listed as a codeowner for? Thanks!

Thanks for the feedback. This isn't a bug, per se – it's a limit exposed by an architectural decision – but I can see the value in your use case. I think it's reasonable to add a scan_interval-esque parameter into the UI options (per ADR-0010, no future device/service functionality that modifies configuration.yaml will be accepted).

Hi @bachya, I'm ok with that. The only reason I'm using configuration.yaml is because the UI didn't allow me to add more than 1 location using the same API key. By looking at the code and the PRs it appears that that has been fixed. If that's the case, I'd be glad to move to using the UI instead of configuration.yaml for this component.

But yeah, having some sort of scan_interval-like configuration via the UI would be very useful.

@chilicheech FYI, if you are on the latest HASS, you are technically using UI configuration, as configuration.yaml entries are automatically imported.

I have just updated to the latest beta (110b0), and now I have just started getting this issue. On the surface, it looks the same, but it is coming much sooner.
Prior to today I have not had any issues with limits for Air Visual

Error:
Error fetching geography data data: Error while retrieving data: call_per_day_limit_reached

YAML:

airvisual:
  api_key: !secret airvisual_key

@BradleyFord As was described to you, the PR is still open and is not in 0.110.0.

@bachya as was described to you in the comment above I am seeing this issue and that is the revision.

Your comment above implies that this issue is not an issue?

Not at all: the issue is still an issue until closed. You specifically mentioned upgrading to the 0.110.0 beta, so I was reminding you that you shouldn’t expect this to be fixed in 0.110.0.

I am seeing the same issue since the update to 0.110.0 yesterday. I only have 1 location selected and my AV dashboard shows 506 calls per day / 3755 per month so I am nowhere near the API limit. It seems that 0.110.0 is not polling more often but is throwing an api limit error too early.

I am still getting call_per_day_limit_reached when I try to add the integration back to HA in 0.110.2. I think this should be treated as non-error and just warning?

@petarvucetin If you were getting the error today and then upgraded to 0.110.2, you're still going to get the error – AirVisual will recycle your call count starting tomorrow. Give that a try and report back here if you still notice issues.

Still not working here

@bachya please help me understand. why are we doing auto-leveling instead of just adding back the scan_interval?

@chilicheech After a discussion with the core team, there is hesitation to expose scandal interval parameters via the UI. This was a method to accomplish a similar end goal without users needing to fiddle.

Maybe it would be possible to expose parameter but enforce the range of values for it, so the users won't be able to set it to unacceptable/dangerous numbers?

@azurek1te That would be an interesting architectural discussion; feel free to open up one here: https://github.com/home-assistant/architecture

Still hits the limit for me too, on 0.110.3 so I don't think this is fixed. Reaches 511 calls per day and then stops updating. Created a new api key several times and the same.

@silviudc I'm running a test now and all of my logic is working correctly. Perhaps my understanding of the limit is incorrect? I'm working off of 10,000 calls per month.

EDIT: well, I don't know _why_, but I can say that I see something similar happening: my AirVisual component is making requests for every monitored geography every 30 seconds... That's a problem. Will dig further.

So when it does stop refreshing it seems to hit around 510-512 calls, and if we go with 10,000 per month and 30 days, you get about 333 per day

I've found the issue – fix forthcoming and will get it into 0.110.4.

this is back in 113.1. Can this be re-opened, or do we need a new issue?

2020-07-26 23:49:46 ERROR (MainThread) [homeassistant.components.airvisual] Error fetching 5redacted, 4.redacted data: Error while retrieving data: api_key_expired
Was this page helpful?
0 / 5 - 0 ratings

Related issues

coolriku picture coolriku  Â·  3Comments

missedtheapex picture missedtheapex  Â·  3Comments

neonandu picture neonandu  Â·  3Comments

Konstigt picture Konstigt  Â·  3Comments

TheZoker picture TheZoker  Â·  3Comments