Repository navigation
Raise BaseStationUnreachableError for comlink 404 responses - #1199
Open
progwriter wants to merge 1 commit into
Open
progwriter wants to merge 1 commit into
progwriter wants to merge 1 commit into
Conversation
Non-cached (forceUpdate=true) SS3 requests can fail with HTTP 404 and
body {"type": "NotFound", "code": "002", "message": "Active sim not
returned from comlink"} when the SimpliSafe cloud can't reach the base
station, while cached requests still succeed.
Map that type/code pair to a new BaseStationUnreachableError (a
RequestError subclass, so existing handlers keep working) so callers
can fall back to cached data. Other NotFound codes are unaffected.
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.
Describe what the PR does:
Problem
Home Assistant polls SS3 systems every 30 seconds with
async_update(cached=False). When the SimpliSafe cloud can't reach the base station for a live refresh, these polls fail with HTTP 404, and each failure logs atERROR:On one system this happened for days: over 1,000 such lines in 10 days, and over half of all polls failed during one afternoon. The same symptom has been reported before:
settings/normal?forceUpdate=truesensors?forceUpdate=trueWith debug logging enabled, the 404 body was:
{"type": "NotFound", "message": "Active sim not returned from comlink", "code": "002", "statusCode": 404, "props": {}}While these requests failed, the subscription data still reported the base station as online (
isOffline: false), and cached requests (forceUpdate=false) to the same endpoints kept succeeding. Today this response surfaces as a genericRequestError, so callers can't tell "the base station can't be reached right now" apart from a real request failure. They can't react to it, for example by falling back to cached data.Solution
BaseStationUnreachableError, a subclass ofRequestError, so existingexcept RequestErrorhandlers keep working.DATA_ERROR_CODE_MAP, keyed on(type, code), becauseNotFoundalone is too generic to map.("NotFound", "002")to the new error. OtherNotFoundcodes still raiseRequestErroras before.docs/system.md.The error is raised from the response body, so this response no longer goes through the backoff give-up path and no longer logs at
ERROR.Future work
Once this is released, the Home Assistant SimpliSafe integration can catch
BaseStationUnreachableErroron its forced poll and retry withcached=True, instead of failing the whole update. Today every such failure marks the update as failed, logs an error, and disconnects the websocket, so real-time events stop until the next successful poll. With the fallback, entities stay available with the latest cached data and the websocket stays connected.Does this fix a specific issue?
No
Checklist:
README.mdwith any new documentation.