Skip to content

Track failed playback commands with bounded retry backoff#259

Open
msgerbush wants to merge 4 commits into
mainfrom
bug/playback-failure-session-state
Open

Track failed playback commands with bounded retry backoff#259
msgerbush wants to merge 4 commits into
mainfrom
bug/playback-failure-session-state

Conversation

@msgerbush
Copy link
Copy Markdown
Collaborator

Summary

This is the first PR in the Sonos stale-IP recovery stack (refs #258). The original issue was triggered when the selected Sonos speaker changed LAN IPs, leaving the running process with a stale SoCo connection. A later pause() call then failed with No route to host.

This PR does not re-resolve stale Sonos speakers yet. Instead, it makes playback command failures safe in the domain state machine:

  • Add PlaybackCommandRetry to PlaybackSession
  • Only update session state after play, resume, pause, or stop succeeds
  • Retry failed playback commands with bounded backoff instead of every loop tick
  • Preserve retry state across brief missed tag reads
  • Avoid setting paused_at when pause() did not actually pause playback

Behavior

When a playback command raises PlaybackError, the session now records retry metadata and leaves the logical playback state unchanged. Matching actions are retried after backoff; unrelated actions can clear or replace the retry state.

This prevents failed commands from making the app believe Sonos changed state when it did not.

Notes

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