{{ message }}
Repository navigation
Conversation
Contributor
Contributor
Catch all aiotankerkoenig errors during the user, reauth and options flows and show a cannot_connect error (or abort the options flow) instead of letting the flow fail with an unhandled exception. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Qr7b4ZqWA7jSV9VE6pAbr
Feed the actual API error payloads through aiotankerkoenig to verify that key related messages (e.g. "Key existiert nicht oder ist deaktiviert" from the linked issue) are reported as invalid_auth and other errors as cannot_connect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Qr7b4ZqWA7jSV9VE6pAbr
The Tankerkoenig API reports a valid key as non-existent while its authentication service is down, so mention this possibility in the invalid_auth error shown in the config, reauth and options flows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Qr7b4ZqWA7jSV9VE6pAbr
Parsing of the API responses is covered by the aiotankerkoenig test suite, the config flow tests mock the library results instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Qr7b4ZqWA7jSV9VE6pAbr
mib1185
force-pushed
the
tankerkoenig-handle-api-errors-config-flow
branch
from
October 10, 2026 20:21
601e737 to
63e2e7f
Compare
frenck
approved these changes
Oct 10, 2026
frenck
left a comment
Member
There was a problem hiding this comment.
Oh hi there @mib1185 👋
My review notes: (this space intentionally left blank). Thanks for the pull request!
../Frenck
Blogging my personal ramblings at frenck.dev
Here is a dad joke for you:
It takes guts to be an organ donor.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
The Tankerkoenig config flow only caught
TankerkoenigInvalidKeyError. Any other API problem crashed the flow with a "500 Internal Server Error", for example a connection error, timeout, rate limit, unexpected API error message or non-JSON maintenance page. This affected the user, reauth and options flows.TankerkoenigErrorand show acannot_connecterror, so the user can try again.cannot_connect, because it needs the station list from the API to build its form.TankerkoenigInvalidKeyError, which the flow shows asinvalid_auth. The API sends this message for valid keys too while its authentication service is down. So theinvalid_authtext now says the service may be temporarily unavailable.Type of change
Additional information
Checklist
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: