feat: Add device selection and management for multi-room audio control - #46
Open
jmward09 wants to merge 1 commit into
Open
feat: Add device selection and management for multi-room audio control#46jmward09 wants to merge 1 commit into
jmward09 wants to merge 1 commit into
Conversation
- Add device_id parameter to Playback tool for device-specific playback - Add new Devices tool for listing and transferring between devices - Enhanced Playback handler to support direct device control via spotipy - Add Devices handler for list and transfer actions - Maintains backward compatibility (device_id is optional) This implements a hybrid approach addressing concerns from PR varunneal#11: - Separate Devices tool for simple device management (easier for small LLMs) - Optional device_id in Playback for inline device control (maintainer preference) - Enables multi-room audio control across Spotify Connect devices Tested with 13 devices including WiiM Pro Plus, Echo devices, and iMac.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds device selection and management capabilities to enable multi-room audio control through Spotify Connect. This feature enables voice assistants and automation systems to route playback to specific devices (e.g., "play this in the kitchen" or "transfer to the living room speaker").
Implementation
This PR implements a hybrid approach that addresses the concerns raised in #11:
Approach 1: Separate Devices Tool (For Simplicity)
Devicestool withlistandtransferactionsApproach 2: Enhanced Playback Tool (For Convenience)
device_idparameter toPlaybacktool'sstartactionThis hybrid approach provides:
Devicestool for discovery and transferChanges
1. Enhanced Playback Tool
When
device_idis provided, the handler uses direct spotipy calls for device control:urisparameter) and context URIs (context_uriparameter)device_idis omitted2. New Devices Tool
Actions:
list: Returns all available Spotify Connect devices with id, name, type, volume, is_activetransfer: Transfers playback to specified device with optional auto-playTesting
Tested with 13 Spotify Connect devices including:
Test Cases:
Use Cases
Relation to #11
This PR addresses the design discussion in #11 where:
device_idto existing toolsOur hybrid approach implements both suggestions, providing the simplicity of a dedicated tool while also offering the convenience of inline device control. This gives users maximum flexibility while maintaining clean separation of concerns.
Backward Compatibility
All existing functionality is preserved:
Playbacktool works exactly as before whendevice_idis omittedDocumentation
Comprehensive documentation included in production deployment:
Would be happy to add documentation to the repo if desired.
Related PRs: