fix: do not fail config entry setup silently - #131
Closed
lstachowiak wants to merge 1 commit into
Closed
lstachowiak wants to merge 1 commit into
lstachowiak wants to merge 1 commit into
Conversation
async_setup_entry returned False when parcel locker data was missing from the config entry or when the parcel locker ID could not be scraped from inpost.pl. Home Assistant turns that into ConfigEntryState.SETUP_ERROR with reason "Unknown error", logs nothing at all and schedules no retry, so the integration stayed dead until the next restart or manual reload. Both cases now raise a proper exception: ConfigEntryError for broken entry data and ConfigEntryNotReady for problems on InPost side, so the reason is logged and transient failures are retried. The parcel locker page URL is built from data stored when the integration was configured. InPost redirects outdated URLs to /znajdz-paczkomat with HTTP 200, which silently produced no regex match - such a redirect is now detected, reported and the parcel locker data is refetched and saved back to the config entry before giving up. Additionally: - read the response body inside the request timeout - session.request() returns as soon as the headers arrive, so a stalled body left the setup hanging for aiohttp's default five minutes without any log entry - log a warning whenever a request fails or the air data cannot be found - report missing air sensors as ConfigEntryError from the coordinator instead of matching the exception message against a string - store parcel locker data in the config entry as a plain dict - cover async_setup_entry with tests
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
async_setup_entry returned False when parcel locker data was missing from the config entry or when the parcel locker ID could not be scraped from inpost.pl. Home Assistant turns that into ConfigEntryState.SETUP_ERROR with reason "Unknown error", logs nothing at all and schedules no retry, so the integration stayed dead until the next restart or manual reload.
Both cases now raise a proper exception: ConfigEntryError for broken entry data and ConfigEntryNotReady for problems on InPost side, so the reason is logged and transient failures are retried.
The parcel locker page URL is built from data stored when the integration was configured. InPost redirects outdated URLs to /znajdz-paczkomat with HTTP 200, which silently produced no regex match - such a redirect is now detected, reported and the parcel locker data is refetched and saved back to the config entry before giving up.
Additionally: