You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unauthorized and LoginRequired raised by aiounifi are not handled in UnifiDataUpdateCoordinator._async_update_data, so they reach the catch-all in DataUpdateCoordinator._async_refresh.
That branch has three properties the other branches do not:
It never raises ConfigEntryAuthFailed and never calls async_start_reauth_if_available(), so the config entry never enters reauth and the user is never prompted.
It is not gated on last_update_success, so it logs a full traceback on every refresh rather than once per failure streak.
Polling continues at POLL_INTERVAL (10s, per coordinator), so the request rate against the controller never drops.
The practical result is that an expired or revoked session produces an unbounded traceback loop that never self-heals, and the sustained login attempts can trip AUTHENTICATION_FAILED_LIMIT_REACHED on the controller — which is what #163913 reports. On my own instance this produced 53 MB of home-assistant.log in 11 hours.
This raises ConfigEntryAuthFailed for both exception types instead, so the coordinator stops polling and the user gets a reauth flow.
Worth noting for reviewers: aiounifi also latches Connectivity.can_retry_login to False after one failed relogin and only restores it on a successful login. Since that object is shared by every coordinator on a hub, the session cannot recover on its own once the flag is down. That is a library-side concern and is out of scope here, but it is why the loop is stable rather than self-correcting.
Note on behavior: entities now become unavailable while authentication is failing, where previously they retained their last known state indefinitely. That is the intended consequence of ConfigEntryAuthFailed and matches how every other integration signals an auth failure, so I have not treated it as a deprecation — happy to revisit if you disagree.
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)
Deprecation (breaking change to happen in the future)
Breaking change (fix/feature causing existing functionality to break)
Code quality improvements to existing code or addition of tests
Unauthorized and LoginRequired raised by aiounifi were not handled in
UnifiDataUpdateCoordinator._async_update_data, so they reached the
catch-all in DataUpdateCoordinator._async_refresh. That branch neither
raises ConfigEntryAuthFailed nor calls async_start_reauth_if_available,
and it is not gated on last_update_success, so an expired or revoked
session produced a full traceback on every refresh and never surfaced a
reauth flow. Polling continued at POLL_INTERVAL against the controller,
which can trip AUTHENTICATION_FAILED_LIMIT_REACHED.
Raise ConfigEntryAuthFailed instead so the coordinator stops polling and
the user is prompted to reauthenticate.
Hey there @Kane610, mind taking a look at this pull request as it has been labeled with an integration (unifi) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of unifi can trigger bot actions by commenting:
@home-assistant close Closes the pull request.
@home-assistant mark-draft Mark the pull request as draft.
@home-assistant ready-for-review Remove the draft status from the pull request.
@home-assistant rename Awesome new title Renames the pull request.
@home-assistant reopen Reopen the pull request.
@home-assistant unassign unifi Removes the current integration label and assignees on the pull request, add the integration domain after the command.
@home-assistant update-branch Update the pull request branch with the base branch.
@home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
@home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.
Restore the omitted PR-template checklist items before merging. The description is missing the documentation checkbox and all three device/web-service dependency checkboxes; every template item must remain present even when unchecked.
The test no longer gets the coordinator or calls async_refresh() directly. It patches api.traffic_rules.update, then uses freezer.tick(POLL_INTERVAL) with async_fire_time_changed(hass) to trigger each poll, the same pattern as test_polling_coordinator_refreshes_after_interval.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
UnauthorizedandLoginRequiredraised byaiounifiare not handled inUnifiDataUpdateCoordinator._async_update_data, so they reach the catch-all inDataUpdateCoordinator._async_refresh.That branch has three properties the other branches do not:
ConfigEntryAuthFailedand never callsasync_start_reauth_if_available(), so the config entry never enters reauth and the user is never prompted.last_update_success, so it logs a full traceback on every refresh rather than once per failure streak.POLL_INTERVAL(10s, per coordinator), so the request rate against the controller never drops.The practical result is that an expired or revoked session produces an unbounded traceback loop that never self-heals, and the sustained login attempts can trip
AUTHENTICATION_FAILED_LIMIT_REACHEDon the controller — which is what #163913 reports. On my own instance this produced 53 MB ofhome-assistant.login 11 hours.This raises
ConfigEntryAuthFailedfor both exception types instead, so the coordinator stops polling and the user gets a reauth flow.Worth noting for reviewers:
aiounifialso latchesConnectivity.can_retry_logintoFalseafter one failed relogin and only restores it on a successful login. Since that object is shared by every coordinator on a hub, the session cannot recover on its own once the flag is down. That is a library-side concern and is out of scope here, but it is why the loop is stable rather than self-correcting.Note on behavior: entities now become
unavailablewhile authentication is failing, where previously they retained their last known state indefinitely. That is the intended consequence ofConfigEntryAuthFailedand matches how every other integration signals an auth failure, so I have not treated it as a deprecation — happy to revisit if you disagree.Type of change
Additional information
EndpointNotFoundinstead of an auth errorChecklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: