Skip to content

Auto-level AirVisual API calls#34903

Merged
MartinHjelmare merged 1 commit intohome-assistant:devfrom
bachya:airvisual-leveling-api-calls
May 21, 2020
Merged

Auto-level AirVisual API calls#34903
MartinHjelmare merged 1 commit intohome-assistant:devfrom
bachya:airvisual-leveling-api-calls

Conversation

@bachya
Copy link
Copy Markdown
Contributor

@bachya bachya commented Apr 29, 2020

Proposed change

Users were reporting that monitoring multiple geographies with the same API key overran their free API limits. In the past, this was resolved by setting high scan_interval values, but since this was removed in #32072, users had no route forward.

This PR adds "self-leveling" to the API: the more clients that use the same API key, the greater the interval between API calls. The values are selected to leave plenty of buffer for the typical "free tier" use case.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

@bachya bachya self-assigned this Apr 29, 2020
@bachya bachya changed the title Airvisual leveling api calls Auto-level AirVisual API calls Apr 29, 2020
@bachya bachya force-pushed the airvisual-leveling-api-calls branch from fb2fc60 to 05af354 Compare May 1, 2020 17:33
@bachya bachya marked this pull request as ready for review May 1, 2020 17:35
@BradleyFord
Copy link
Copy Markdown

I have updated to 110 beta0.
Within 8 hours I have hit my API limited for the day; I assume there must be some problem with the auto levelling?

@frenck
Copy link
Copy Markdown
Member

frenck commented May 14, 2020

@BradleyFord This is an open PR, which implements auto-leveling. Since it is open, it is not part of 0.110.

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@MartinHjelmare MartinHjelmare merged commit f5a326c into home-assistant:dev May 21, 2020
@frenck
Copy link
Copy Markdown
Member

frenck commented May 21, 2020

@bachya @MartinHjelmare Should we add this to a patch release? As I've seen quite a few people running into the limits... ?

@MartinHjelmare
Copy link
Copy Markdown
Member

Ok with me.

@MartinHjelmare MartinHjelmare added this to the 0.110.2 milestone May 21, 2020
@bachya bachya deleted the airvisual-leveling-api-calls branch May 21, 2020 13:46
frenck pushed a commit that referenced this pull request May 24, 2020
@frenck frenck mentioned this pull request May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Airvisual call_per_month_limit_reached

6 participants