Skip to content

Fix/status query retry 153218#5

Open
Ultra-bob wants to merge 2 commits into
LennP:mainfrom
Ultra-bob:fix/status-query-retry-153218
Open

Fix/status query retry 153218#5
Ultra-bob wants to merge 2 commits into
LennP:mainfrom
Ultra-bob:fix/status-query-retry-153218

Conversation

@Ultra-bob

Copy link
Copy Markdown

Addresses review comments on #4.

Why not do the retries and timeout in the @requires_end_positions?

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 blocking establish_connection on it or waiting for a @requires_end_positions function to be called. For now, I've applied your recommendation.

Ultra-bob and others added 2 commits June 30, 2026 10:33
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>
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.

1 participant