Repository navigation
fix(models): accept integer ErrorCode/WarningCode in ApplianceStatus - #127
Merged
Merged
Conversation
GetApplianceOverview returns ErrorCode and WarningCode as integers (0 when the appliance is healthy), but ApplianceStatus types them as str, so model_validate raised a ValidationError for every status poll. Coerce ints to str in a before-validator so the public type is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 11, 2026
Closed
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.
Summary
GetApplianceOverviewreturnsErrorCodeandWarningCodeas integers (0when the appliance is healthy), butApplianceStatustypes them asstr. In pydantic v2 that fails strict string validation, soget_appliance_overview()raises for any hub whose appliances report a numeric code:In the Home Assistant integration this surfaces as "Failed setup, will retry: Unexpected error fetching status", and the integration never finishes loading.
This adds a
mode="before"validator that turnsintintostrfor those two fields (and leavesboolalone), so the public type staysstr | Noneand existing callers are unaffected.Testing
test_appliance_status_accepts_integer_error_and_warning_codes(fails onmain, passes here).ruff check,ruff format --check,mypyandpytestpass locally. The one exception istest_repo_scripts.py::test_check_md_alerts_passes, which also fails onmainunder macOS's bash 3.2 (mapfile: command not found).🤖 Generated with Claude Code