Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recover CoAP pairing when remote device stops responding #358

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

Jc2k
Copy link
Owner

@Jc2k Jc2k commented Feb 2, 2024

Prior to this change if a remote device stopped responding (e.g. packet loss) we would never recover - we'd just keep incrementing the encryption counter making it further and further away from the truth.

The only way to recover from this right now is to restart HA which obviously resets the encryption session.

This patch can't fix the buggy device, unstable network or packet loss that lead to a timeout in the first place but it can help things recover without needing a full HA restart.

Tested by a community member with a very unstable set of Nanoleaf devices (multiple devices go offline at same time, and with this patch they actually recover by themselves).

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (d7acbf8) 74.54% compared to head (db39883) 74.51%.

Files Patch % Lines
aiohomekit/controller/coap/connection.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #358      +/-   ##
==========================================
- Coverage   74.54%   74.51%   -0.04%     
==========================================
  Files          99       99              
  Lines        9327     9331       +4     
==========================================
  Hits         6953     6953              
- Misses       2374     2378       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Jc2k Jc2k merged commit 2377b7b into main Feb 2, 2024
10 of 12 checks passed
@Jc2k Jc2k deleted the thread-reconnect branch February 2, 2024 22:25
@Jc2k
Copy link
Owner Author

Jc2k commented Feb 2, 2024

Cheers

@codyc1515
Copy link

codyc1515 commented Feb 5, 2024

Fantastic to see! We really appreciate it.

Do you have an issue # on here where someone faced this issue that you expect it would be resolved? i.e. is this just going to fix (workaround) the encryption counter issue or we would expect it to also fix ones like below

Logger: aiohomekit.controller.coap.pdu
Source: components/homekit_controller/connection.py:283
First occurred: 13:56:35 (6 occurrences)
Last logged: 15:33:15

Transaction 0 failed with error 6 (Invalid request

@Jc2k
Copy link
Owner Author

Jc2k commented Feb 5, 2024

No, it's just something we worked through on discord.

It will just stop (some?) devices getting stuck offline.

I seem to remember your error was known to the original dev of coap support, and it was harmless.

@codyc1515
Copy link

Mint. I see no Unavailable messages in my logs anymore, so was curious what changed. Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants