Fix/status query retry 153218#5
Open
Ultra-bob wants to merge 2 commits into
Open
Conversation
After connecting, the library sends SET_KEY then STATUS_QUERY and relies on the motor's status notification to populate end position info. Commands are gated behind that notification via @requires_end_positions, which awaited the event with no timeout. If the motor never returned a status notification (intermittent, especially right after a reboot), the command blocked forever: the blind stayed "connected", the move command was never sent, and battery/ speed/position stayed unknown. Reported as Home Assistant core issue #153218. - establish_connection now waits briefly after SET_KEY for all blind types (was CURTAIN/VERTICAL only) and retries STATUS_QUERY until a status notification arrives, disconnecting and returning False if it never does. - requires_end_positions now bounds its wait so a missing notification can no longer hang a command. - Adds SETTING_MAX_STATUS_QUERY_ATTEMPTS, SETTING_STATUS_QUERY_TIMEOUT and SETTING_END_POSITION_INFO_TIMEOUT. - Adds a test for the retry-then-abort path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Revert establish_connection to its original behavior (conditional notification delay, single status query) - Retry the status query in @requires_end_positions instead, so only commands that need end position info wait for the notification - Drop the constant comments and the now-redundant SETTING_END_POSITION_INFO_TIMEOUT Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Addresses review comments on #4.
If the user connects but never triggers anything decorated with
@requires_end_positions, and the motor never responds to the initial status query, the battery level and other status data stays unknown for the lifetime of that connection. This looks unintentional, since a status query is sent on connection to populate those fields. Instead, we could retry the status query in a background task on connect, rather than blockingestablish_connectionon it or waiting for a@requires_end_positionsfunction to be called. For now, I've applied your recommendation.