Recover CoAP pairing when remote device stops responding #358
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.
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).