Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1771 +/- ##
=======================================
Coverage 93.31% 93.31%
=======================================
Files 158 158
Lines 9977 9985 +8
Branches 1025 1028 +3
=======================================
+ Hits 9310 9318 +8
Misses 472 472
Partials 195 195 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Sep 29, 2026
rytilahti
approved these changes
Oct 1, 2026
rytilahti
left a comment
Member
There was a problem hiding this comment.
LGTM after making the comment more generic and moving it up, thanks for the PR!
Comment on lines
+278
to
+279
| # The camera dropped the session (a C220 on 1.4.4 does this about | ||
| # every ten minutes): handshake again and retry the request. |
Member
There was a problem hiding this comment.
Please move this comment above the if condition, and remove the exact model/version numbers, and just state that some devices return this when requiring a reauth.
Contributor
Author
|
Done: the comment is now above the |
rytilahti
approved these changes
Oct 1, 2026
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.
Related to #1739 and home-assistant/core#179553.
Some cameras (C220 and C100 on the 1.4.4 line in those reports) drop the session about every ten minutes and answer the next
securePassthroughwith HTTP 401 and-40421in the body. The transport currently turns that into a plainKasaException, whichSmartProtocol._querydoes not retry, so Home Assistant logs an error and the request is lost. The following poll works because the transport state was reset in between.With this change a 401 on passthrough marks the transport as needing a handshake and raises
_RetryableError, so the protocol logs in again and retries the same request. That matches what already happens when the device reportsSESSION_EXPIREDinside a 200 response, it just covers the case where the camera says it with the status code.Test added: after a successful handshake, a 401 on the passthrough raises the retryable error and leaves the transport in
HANDSHAKE_REQUIRED.