core: Awair Cloud integration retries excessively when encountering an error and exhausts API rate-limits
The problem
After upgrading to 2021.12.10 my existing Awair integration from configuration.yaml carried over, but doesn’t seem to work beyond authentication. My email and app id appear in the logs, so it does appear that the auth handshake is working.
Config entry '<my-email> (<my-awair-app-id>)' for awair integration not ready yet; Retrying in background
I removed the YAML integration (since it’s deprecated anyways) and then also removed the integration from the UI before re-adding it. While the integration again appears to authenticate fine, I’m now seeing a ratelimit error in the logs:
Config entry '<my-email> (<my-awair-app-id>)' for awair integration not ready yet: The ratelimit for the Awair API has been exceeded. Please try again later; Retrying in background
I think the ratelimit might just be a symptom, as it only showed up after I’d been struggling with the integration for a bit. But since I’m hitting the rate limit I’ve disabled my integration for now and will try to enable more verbose logging before enabling it again.
What version of Home Assistant Core has the issue?
core-2021.12.10
What was the last working version of Home Assistant Core?
core-2021.11.5
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Awair
Link to integration documentation on our website
https://www.home-assistant.io/integrations/awair
Example YAML snippet
# Existing YAML integration prior to upgrade, token pulled from secrets
sensor:
- platform: awair
access_token: !secret awair_access_token
Anything in the logs that might be useful for us?
No response
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 33 (14 by maintainers)
I just re-enabled my integration after a few months off and everything seems fine, so with it established that exponential backoff (or some other rate-limit sensitive approach) really would “solve” this (as much as you can solve for a shaky API) I’m going to edit the title of this issue to better reflect that.
There is a PR in progress for the Local API: https://github.com/home-assistant/core/pull/75535
However, I will try to reprioritize this in the next day or so. There are examples of integrations manually doing exponential backoff; and the Debouncer class that is used in the
DataUpdateCoordinatorcan be customized in ways that might work fine for this.FWIW I’ve been busy, but noticed today that my Awair integration stopped working again a day or two after my last update. Awair’s API has been rather flaky even from the official app as of late, with a complete outage a few weeks back so I think your observations around the device list and any transient issues leading to quota exhaustion make perfect sense.
I’m having a new HVAC system today, so it’s a perfect storm to upgrade everything HASS to the latest and greatest. I’ll update here if anything changes.
I figured out that my lack of logs was due to a missing letter in my configuration. That’s fixed and I’ll keep an eye out for info.
I appreciate you digging into it!