Skip to content

Commit bb6daff

Browse files
majamassariniclaude
andcommitted
Filter volume trigger updates during fading states
When a sound player is in a FadeIn or FadeOut state, the volume is constantly changing through scheduled ramp commands. Incoming volume trigger events from the Sonos device during this time may report stale values that don't match the appliance's internal state. This change filters volume trigger updates when the appliance is in a fading state (has is_fading=True), preventing the stale volume values from updating the appliance state. Note: This only filters incoming volume TRIGGERS (events from device). Outgoing volume ramp COMMANDS (scheduled during fade) continue to be sent normally via Command.make_msgs_from() which checks is_fading=True. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent f491172 commit bb6daff

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

soco_plugin/trigger/volume.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ def make_new_state_from(
2929
>>> d = soco_plugin.Description(msg)
3030
>>> new_state = trigger.make_new_state_from(d, old_state)
3131
"""
32+
# Skip volume updates when in fading state
33+
# Volume is constantly changing during fade and incoming values may be stale
34+
if hasattr(old_state, 'is_fading') and old_state.is_fading:
35+
return old_state
36+
3237
new_state = super(Trigger, self).make_new_state_from(
3338
another_description, old_state
3439
)

0 commit comments

Comments
 (0)