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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Significantly reduce the number of API calls that the august integration #31685


Copy link

bdraco commented Feb 10, 2020

Breaking change

Proposed change

This is a followup to PR #31558

It seems that the folks at August were not so thrilled with the number of API calls unofficial integrations were making, which likely lead to the implementation of the HTTP 429s.

The goal is to make home assistant more sustainable for August, and reduce the amount of load on their servers as much as possible. The hope is that there isn鈥檛 any need for them to do any more disruptive rate-limiting, and the component stays working for everyone.

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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:


  • 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
@project-bot project-bot bot added this to Needs review in Dev Feb 10, 2020
@bdraco bdraco requested a review from MartinHjelmare Feb 10, 2020
@bdraco bdraco force-pushed the bdraco:reduce_number_of_august_apis_round_two_for_upstream branch 4 times, most recently from 8a9c228 to e5259b7 Feb 10, 2020

This comment has been minimized.

Copy link

codecov bot commented Feb 10, 2020

Codecov Report

Merging #31685 into dev will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev   #31685      +/-   ##
+ Coverage   94.64%   94.65%   +0.01%     
  Files         756      762       +6     
  Lines       54808    55017     +209     
+ Hits        51872    52077     +205     
- Misses       2936     2940       +4     
Impacted Files Coverage 螖
homeassistant/components/light/ 93.93% <0.00%> (-6.07%) 猬囷笍
homeassistant/components/vizio/ 100.00% <0.00%> (酶) 猬嗭笍
...tant/components/device_automation/ 100.00% <0.00%> (酶) 猬嗭笍
homeassistant/components/dynalite/ 95.65% <0.00%> (酶)
homeassistant/components/melcloud/ 100.00% <0.00%> (酶)
homeassistant/components/dynalite/ 98.41% <0.00%> (酶)
homeassistant/components/dynalite/ 100.00% <0.00%> (酶)
homeassistant/components/dynalite/ 97.36% <0.00%> (酶)
homeassistant/components/melcloud/ 97.56% <0.00%> (酶)
homeassistant/helpers/ 97.60% <0.00%> (+0.02%) 猬嗭笍
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 118ba10...5a05c87. Read the comment docs.


This comment has been minimized.

Copy link
Contributor Author

bdraco commented Feb 10, 2020

Will fix the CI issues and resub


The poll interval for the lock status API is now 15 minutes
instead of every 10 seconds because we can use the activity
API to see changes in lock state.  The interval for the
activity API is 10 seconds which allows for the same
frequency of state monitoring without all the additional API calls.
With four locks, this change results in an ~80% reduction in the number
of API calls.

The result of the lock and unlock APIs now update the lock state instead
of waiting for the next poll.  This change also has the added benefit of
making the UI appear far more responsive.
@bdraco bdraco force-pushed the bdraco:reduce_number_of_august_apis_round_two_for_upstream branch from e5259b7 to 5de0f97 Feb 10, 2020

This comment has been minimized.

Copy link
Contributor Author

bdraco commented Feb 10, 2020

As soon as this one is worked out, I have another few to submit on top of this.

  1. Bump upstream library version and add support for door sense in the activity log
  2. Add automatic token refresh support (no more relogin every 6 months)
  3. Some general refactoring and tests (since this module needs a bit of love in that area)
Copy link

MartinHjelmare left a comment

It's a bit hard to follow all the different attribute accesses in this integration but nothing bad sticks out.

homeassistant/components/august/ Outdated Show resolved Hide resolved
Copy link

MartinHjelmare left a comment

Looks good!

Dev automation moved this from Needs review to Reviewer approved Feb 11, 2020
@springstan springstan merged commit ecd7ec3 into home-assistant:dev Feb 11, 2020
10 checks passed
10 checks passed
CI Build #20200211.3 succeeded
CI (FullCheck Mypy) FullCheck Mypy succeeded
CI (FullCheck Pylint) FullCheck Pylint succeeded
CI (Overview CheckFormat) Overview CheckFormat succeeded
CI (Overview Lint) Overview Lint succeeded
CI (Overview Validate) Overview Validate succeeded
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
cla-bot Everyone involved has signed the CLA
codecov/patch Coverage not affected when comparing 2e703ce...5a05c87
codecov/project 94.65% (target 90.00%)
Dev automation moved this from Reviewer approved to Done Feb 11, 2020
@bdraco bdraco mentioned this pull request Feb 11, 2020
8 of 20 tasks complete
@lock lock bot locked and limited conversation to collaborators Feb 12, 2020
@bdraco bdraco deleted the bdraco:reduce_number_of_august_apis_round_two_for_upstream branch Feb 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can鈥檛 perform that action at this time.