Try direct BLE authentication before double-connect fallback#23
Open
alexanderpett wants to merge 1 commit into
Open
Try direct BLE authentication before double-connect fallback#23alexanderpett wants to merge 1 commit into
alexanderpett wants to merge 1 commit into
Conversation
Owner
|
Good idea! I'll take a look at this in the next few days. |
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.
Summary
This PR changes the BLE mesh connection flow so pyplejd first tries to authenticate on the initial BLE connection and only falls back to the existing disconnect/reconnect workaround if that first authentication attempt fails.
The current code always does:
That unconditional double-connect appears to trigger reconnect throttling or unstable mesh behavior on some setups with Plejd firmware 6.43.3.
Why
I have been troubleshooting a reproducible hass-plejd 0.21.3 / pyplejd 0.21.3 problem where:
Related hass-plejd issue: thomasloven/hass-plejd#162
Related prior discussion: thomasloven/hass-plejd#154
Approach
This PR keeps the workaround available as a fallback instead of removing it completely:
This should preserve compatibility with setups where the workaround is still needed, while avoiding an unnecessary forced reconnect on setups where the first connection is already valid.
Local validation
Validated on Home Assistant OS with hass-plejd 0.21.3 and Plejd firmware 6.43.3 using a forked pyplejd build. After the change:
Commands to non-gateway Plejd lights now execute immediately.
Notes
This is intentionally conservative because issue #154 suggests the workaround may still be required for some combinations of hardware/firmware. The goal is to avoid the workaround when it is not needed, not to remove it entirely.