ITADN

bug: bluetooth streaming state toggle is non-idempotent (duplicate push events invert state)

#3454Opencoderabbitai[bot] 创建于 2026-05-10
alexa_media
## Summary In `custom_components/alexa_media/media_player.py` (lines 570–584), the `bluetooth_streaming_change` handler infers the new state by **flipping** the cached `_media_player_state`/`_session["state"]`. This is not idempotent: a duplicate or reordered `STREAMING_STATE_CHANGED` push event will invert the entity into the wrong state, causing subsequent play/pause commands to operate on stale/incorrect local state. ## Severity **Deferrable** — only affects bluetooth streaming users when duplicate/reordered HTTP2 push events occur. ## Proposed Fix Instead of toggling, read the explicit streaming state from the event payload when available. Only fall back to a full device state refresh (not a toggle) when the payload does not contain an explicit state value. ## References - Introduced in: #3449 (by @danielbrunt57) - Identified in: #3450 - Requested by: @alandtse
1 条评论