Skip to content

Remove Sonos event filtering to allow all events processing#1

Open
majamassarini wants to merge 2 commits intodevfrom
sonos-remove-event-filtering
Open

Remove Sonos event filtering to allow all events processing#1
majamassarini wants to merge 2 commits intodevfrom
sonos-remove-event-filtering

Conversation

@majamassarini
Copy link
Owner

@majamassarini majamassarini commented Jan 25, 2026

No description provided.

@majamassarini majamassarini force-pushed the sonos-remove-event-filtering branch from bb6daff to bea40ed Compare January 31, 2026 16:55
The previous event filtering waited for command confirmation but
caused two main problems:
1. Events from remote devices (physical remotes, other apps) were dropped
   during the 1-second waiting window
2. Non-matching event types were discarded when expecting a specific response

New approach uses time-based filtering to prevent command echo events:
- After sending configuration commands (mode, playlist, volume), record timestamp
- Ignore pause/play events for 3 seconds after configuration commands
- Process all other events immediately (stop, volume)
- After timeout, process pause/play events normally

This fixes the circadian rhythm forced state problem where Sonos sends
pause during mode/playlist reconfiguration, causing the state machine
to exit forced circadian rhythm state prematurely.

Trade-off: User actions via Sonos app or physical controls during the
3-second window after config commands will be ignored.

Assisted-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@majamassarini majamassarini force-pushed the sonos-remove-event-filtering branch 2 times, most recently from d9ae1b7 to ea78877 Compare February 5, 2026 19:13
The command echo problem (Sonos sending pause/play events during
reconfiguration that incorrectly unforce appliance states) is now handled
at the automate-home level via two new scheduler trigger types:

- state.entering.disable_events.Trigger: immediately disables
  forced.Event.Off in the appliance state machine when entering a playing
  state (Fade In, Forced On, Forced Circadian Rhythm).
- state.entering.delay.enable_events.Trigger: re-enables it after 30
  seconds so legitimate user stop/pause commands are processed again.

The gateway now passes all Sonos events through without any filtering.
The suppression window is configured entirely in the automate-home
scheduler trigger YAML.

Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@majamassarini majamassarini force-pushed the sonos-remove-event-filtering branch from ea78877 to ffd48ac Compare February 22, 2026 16:52
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