Repository navigation
Conversation
The CatLink API returns catLitterWeight/deodorantCountdown/inductionTimes/ manualTimes present-but-null on some models (C08/SCOOPER especially). dict.get(key, default) only fires on missing keys, so int(None)/None-minus- float raised on every read (~every 60s poll) and empty successful log responses were logged as warnings. - guard all four fields explicitly (extends upstream PR hasscc#67 with the same pattern applied to the clean-time fields and state attrs) - demote 'successful but empty device logs' from warning to debug - regression tests for each null field + the log-warning behavior
…y registered; old list omitted 'number')
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.
Fixes #63 (supersedes/extends #67)
Same root cause as PR #67: the CatLink API returns
catLitterWeight/deodorantCountdownpresent but null on C08/SCOOPER models, anddict.get(key, default)only fires on missing keys — soint(None)/None - floatraised every poll (~60s) and flooded the log. PR #67 fixes those two fields; this extends the identical pattern to the same class of crash in three more places I found in the file:total_clean_time(int(inductionTimes)+int(manualTimes)) — same null-API exposuremanual_clean_time(get("manualTimes", 0)default skipped when value is null)_base_state_attrs()["total_clean_times"]— now reuses the guarded property instead of duplicating the unsafe expressionwarningevery poll → downgraded todebug(keptwarningfor real failures), including the duplicated block inscooper_pro_ultra.pyTests
test_litter_device.py)229 passed locally (Python 3.13).