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 call_per_month_limit_reached #34787

Closed
chilicheech opened this issue Apr 27, 2020 · 21 comments · Fixed by #34903 or #36199
Closed

Airvisual call_per_month_limit_reached #34787

chilicheech opened this issue Apr 27, 2020 · 21 comments · Fixed by #34903 or #36199

Comments

@chilicheech
Copy link
Contributor

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

@probot-home-assistant
Copy link

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!

@bachya
Copy link
Contributor

bachya commented Apr 27, 2020

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

@chilicheech
Copy link
Contributor Author

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.

@bachya
Copy link
Contributor

bachya commented Apr 27, 2020

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

@BradleyFord
Copy link

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

@bachya
Copy link
Contributor

bachya commented May 14, 2020

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

@BradleyFord
Copy link

BradleyFord commented May 14, 2020

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

@bachya
Copy link
Contributor

bachya commented May 14, 2020

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.

@BertrumUK
Copy link

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.

@petarvucetin
Copy link

petarvucetin commented May 24, 2020

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?

@bachya
Copy link
Contributor

bachya commented May 24, 2020

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

@BertrumUK
Copy link

Still not working here

@chilicheech
Copy link
Contributor Author

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

@bachya
Copy link
Contributor

bachya commented May 26, 2020

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

@azurek1te
Copy link

azurek1te commented May 26, 2020

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?

@bachya
Copy link
Contributor

bachya commented May 26, 2020

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

@silviudc
Copy link

silviudc commented May 27, 2020

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.

@bachya
Copy link
Contributor

bachya commented May 27, 2020

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

@silviudc
Copy link

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

@bachya
Copy link
Contributor

bachya commented May 27, 2020

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

@Mariusthvdb
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants