feat(USA): retry start_climate without seat settings on parameter failure - #1179
Open
blka wants to merge 7 commits into
Open
feat(USA): retry start_climate without seat settings on parameter failure#1179blka wants to merge 7 commits into
blka wants to merge 7 commits into
Conversation
…tionError, 400→APIError
…exception
HyundaiBlueLinkApiUSA: replace except APIError with response-level check
('errorCode' in response_json). This fixes the errorCode 502 overload
problem — 502 triggers retry too (one extra API call if truly auth, but
no missed parameter-error-502). Matches CA climate retry pattern.
KiaUvoApiUSA: add explicit except AuthenticationError: raise before
except RequestException to prevent seat retry on auth failures.
Add design doc with analysis of errorCode 502 overload and approach
comparison (egmp vs exception-based vs response-level).
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.
Problem
Some USA vehicles (particularly gen 3 EVs with heated/vented seats) reject the
seatHeaterVentInfo/heatVentSeatpayload instart_climate(). The API returns an error code, but the command itself is valid — it just needs to be sent without seat settings.This matches behavior in egmp-bluelink-scriptable, which retries climate start without seat settings on any failure.
Solution
HyundaiBlueLinkApiUSA — Response-level check
Instead of catching
APIError(which misses errorCode 502 due to the 502→AuthenticationError mapping), check the response JSON before calling_check_response_for_errors:This pattern:
Why not
except APIError? errorCode"502"is overloaded in the Hyundai USA API — it maps toAuthenticationErrorin_check_response_for_errors, but the server also uses 502 for non-auth failures (e.g., rate limiting witherrorSubCode == "HT_534"). If the server returns 502 for seat parameter errors,except APIErrorwould never catch it.KiaUvoApiUSA — Explicit auth error bypass
Added
except AuthenticationError: raisebeforeexcept RequestExceptionso auth errors don't trigger the seat-setting retry.Testing
Hyundai USA — 6 tests:
Kia USA — 4 tests:
@cdnninja — I went with a response-level check pattern for Hyundai USA instead of exception-based retry, because errorCode 502 is overloaded (auth + rate limiting + possibly parameter errors). This means 502 triggers the retry too — if it's truly an auth error, the second call also gets 502 and raises AuthenticationError (one extra API call, no harm). Would appreciate your take on this approach vs a stricter exception-based one.