---
title: "Feature Development History"
sidebar:
  exclude: true
---
This document tracks the detailed evolution of features and capabilities in the Bose SoundTouch API client library.

## Development Timeline

### Phase 1: Foundation (January 2026)

#### Core HTTP Client
- **HTTP Client with XML Support**: Complete client implementation for SoundTouch Web API
- **XML Model System**: Comprehensive typed models for all API responses
- **Error Handling**: Robust error handling with contextual error messages
- **Configuration Management**: Flexible configuration via environment variables and config files

#### Basic Device Control
- **Device Information**: `/info` endpoint for device details and capabilities
- **Device Name**: `/name` endpoint for device identification
- **Device Capabilities**: `/capabilities` endpoint for feature detection
- **Now Playing Status**: `/now_playing` endpoint for current playback information

#### Initial CLI Tool
- Basic command-line interface for testing API functionality
- Device connectivity testing
- Simple information retrieval commands

### Phase 2: Media Control & Discovery (January 2026)

#### Media Controls
- **Key Commands**: Complete implementation of `/key` endpoint
  - Play, pause, stop, track navigation
  - Volume up/down via key presses
  - Preset selection (1-6)
  - Power and mute controls
  - Proper press+release pattern implementation
- **Volume Management**: `/volume` GET/POST endpoints
  - Direct volume setting (0-100)
  - Incremental volume control
  - Safety features and validation warnings
  - Volume level categorization (quiet, medium, loud, very loud)

#### Device Discovery
- **UPnP/SSDP Discovery**: Automatic device discovery using Universal Plug and Play
- **Device Caching**: TTL-based caching for improved performance
- **CLI Discovery Commands**: Device discovery integration in CLI tool

#### Enhanced CLI
- **Host:Port Parsing**: Support for `device:port` format in CLI
- **Comprehensive Commands**: Full coverage of implemented endpoints
- **Interactive Features**: Better user experience with formatted output

### Phase 3: Advanced Audio Controls (January 2026)

#### Audio Management Trilogy
- **Bass Control**: `/bass` GET/POST endpoints
  - Range validation (-9 to +9)
  - Incremental bass adjustment
  - Device capability detection via `/bassCapabilities`
  - Safety limits and user warnings
- **Balance Control**: `/balance` GET/POST endpoints
  - Stereo balance adjustment (-50 to +50)
  - Left/right channel convenience methods
  - Balance centering functionality
  - Device-dependent feature (not all devices support balance)

#### Source Selection
- **Source Management**: `/sources` GET and POST `/select` endpoints
- **Convenience Methods**: Direct source selection helpers
  - `SelectSpotify()` - Switch to Spotify
  - `SelectBluetooth()` - Switch to Bluetooth
  - `SelectAux()` - Switch to AUX input
  - `SelectTuneIn()` - Switch to TuneIn radio
  - `SelectPandora()` - Switch to Pandora
- **Source Validation**: Comprehensive source availability checking
- **Account Management**: Support for multi-account sources (Spotify, etc.)

#### Preset Management (Read-Only)
- **Preset Analysis**: Complete preset configuration analysis
- **Helper Methods**: Preset management utilities
  - `GetNextAvailablePresetSlot()` - Find empty preset slots
  - `IsCurrentContentPresetable()` - Check if content can be saved as preset
  - Preset categorization and filtering
- **API Limitation Documentation**: Clarified that POST `/presets` is officially N/A

### Phase 4: System Features (January 2026)

#### Clock and Display Management
- **Clock Time**: `/clockTime` GET/POST endpoints
  - Get/set device time
  - `SetClockTimeNow()` convenience method
  - Time format handling
- **Clock Display**: `/clockDisplay` GET/POST endpoints
  - Display enable/disable
  - Brightness control (low/medium/high)
  - 12/24 hour format selection
  - Convenience methods for common operations

#### Network Information
- **Network Info**: `/networkInfo` GET endpoint
- **Network connectivity details and diagnostics

#### Enhanced Discovery
- **mDNS/Bonjour Discovery**: Multicast DNS device discovery
- **Unified Discovery Service**: Combined UPnP + mDNS + configured devices
- **Multiple Discovery Protocols**: Fallback discovery methods for different network environments
- **Corporate Network Support**: Discovery options for restricted networks

### Phase 5: Real-time Events (January 2026)

#### WebSocket Implementation
- **WebSocket Client**: Complete WebSocket implementation for real-time events
- **Event System**: Comprehensive event type support
  - `NowPlayingUpdated` - Track changes, playback status
  - `VolumeUpdated` - Volume and mute status changes
  - `ConnectionStateUpdated` - Network connectivity
  - `PresetUpdated` - Preset configuration changes
  - `ZoneUpdated` - Multiroom zone changes
  - `BassUpdated` - Bass level adjustments
  - `SdkInfoUpdated` - Server version information
  - `UserActivityUpdated` - User interaction notifications

#### Connection Management
- **Auto-Reconnection**: Automatic reconnection with exponential backoff
- **Connection Monitoring**: Real-time connection state tracking
- **Error Recovery**: Robust error handling and recovery mechanisms
- **Event Filtering**: Subscribe to specific event types

#### WebSocket CLI Integration
- **Real-time Monitoring**: Live event streaming in CLI
- **Event Filtering**: Command-line event type filtering
- **Formatted Output**: Human-readable event display
- **Demo Applications**: WebSocket demonstration tools

### Phase 6: Multiroom Zone Management (January 2026)

#### Zone Operations
- **Zone Information**: `/getZone` GET endpoint
  - Current zone configuration retrieval
  - Master/slave device identification
  - Zone membership queries
- **Zone Management**: `/setZone` POST endpoint
  - Zone creation with multiple devices
  - Add devices to existing zones
  - Remove devices from zones
  - Dissolve zones completely

#### High-Level Zone API
- **Fluent API**: Easy-to-use zone management methods
  - `CreateZone()` - Create multiroom zones
  - `AddToZone()` - Add devices to existing zones
  - `RemoveFromZone()` - Remove devices from zones
  - `DissolveZone()` - Break up zones
- **Zone Status**: Zone membership and status queries
  - `IsInZone()` - Check if device is in a zone
  - `GetZoneStatus()` - Get zone configuration
  - `GetZoneMembers()` - List all zone members

#### Low-Level Zone API
- **Zone Slave Management**: Direct slave operations
  - `/addZoneSlave` POST endpoint
  - `/removeZoneSlave` POST endpoint
  - Device ID and IP-based operations

#### Validation and Safety
- **IP Validation**: Comprehensive IP address validation
- **Duplicate Detection**: Prevent duplicate zone members
- **Error Handling**: Specific zone-related error types
- **Zone Builder**: Fluent API for zone construction

### Phase 7: Advanced Audio Controls (January 2026)

#### Professional Audio Features
- **DSP Audio Controls**: `/audiodspcontrols` GET/POST endpoints
  - Audio mode switching (movie, music, dialogue, etc.)
  - Video sync delay adjustment
  - DSP parameter configuration
- **Advanced Tone Controls**: `/audioproducttonecontrols` GET/POST endpoints
  - Professional-grade bass and treble adjustment
  - Extended range beyond basic `/bass` endpoint
  - Fine-grained audio tuning
- **Speaker Level Controls**: `/audioproductlevelcontrols` GET/POST endpoints
  - Individual speaker level adjustment
  - Front-center speaker level control
  - Rear-surround speakers level control
  - Multi-channel audio management

#### Device Capability Integration
- **Automatic Capability Detection**: Check device capabilities before feature access
- **Conditional Feature Availability**: Features only available on compatible devices
- **Graceful Degradation**: Fallback to basic controls when advanced features unavailable

### Phase 8: Speaker Notification System (February 2026)

#### Notification Features
- **Text-to-Speech (TTS)**: `/speaker` POST endpoint for TTS messages
  - Multi-language support (EN, DE, ES, FR, IT, NL, PT, RU, ZH, JA, etc.)
  - Google TTS integration with URL encoding
  - Custom volume control with automatic restoration
  - Configurable service metadata for NowPlaying display
- **URL Audio Playback**: `/speaker` POST endpoint for URL content
  - HTTP/HTTPS audio content playback
  - Custom metadata support (service, message, reason fields)
  - Volume control with automatic restoration
  - Content interruption and resume functionality
- **Notification Beep**: `/playNotification` GET endpoint
  - Simple double beep notification sound
  - Content pause/resume during notification
  - Quick connectivity testing

#### Smart Home Integration
- **Home Automation Support**: Perfect for smart home notifications
  - Doorbell alerts with custom TTS messages
  - Security system integration with audio alerts
  - IoT device status announcements
- **Emergency Notifications**: High-priority alert system
  - Volume override for critical alerts
  - Custom audio content for specific scenarios
  - Zone-wide notifications for multiroom setups

#### Device Compatibility
- **ST-10 Series Support**: Primary compatibility with ST-10 (Series III) speakers
- **Device Detection**: Automatic capability checking
- **Error Handling**: Graceful degradation for unsupported devices
- **Volume Management**: Intelligent volume restoration

#### CLI Integration
- **Comprehensive Commands**: Full CLI support for all notification types
  - `speaker tts` - Text-to-speech with language options
  - `speaker url` - URL content playback with metadata
  - `speaker beep` - Simple notification beep
  - `speaker help` - Detailed functionality guide
- **Parameter Validation**: Complete input validation and error handling
- **Usage Examples**: Extensive real-world usage examples

### Phase 9: Bug Fixes and Stability (February 2026)

#### Critical Bug Fixes
- **PlayNotificationBeep HTTP Method Fix**: Corrected `/playNotification` endpoint to use GET instead of POST
  - **Issue**: `go run ./cmd/soundtouch-cli --host <device> sp beep` was failing with HTTP 400 status
  - **Root Cause**: Go client was sending POST requests while SoundTouch devices expect GET requests
  - **Fix**: Updated `PlayNotificationBeep()` method to use the existing `c.get()` method with `StationResponse` model
  - **Verification**: Tested with SoundTouch 20, confirmed compatibility with curl equivalent (`curl http://<device>:8090/playNotification`)

#### Code Quality Improvements
- **Consistent HTTP Method Usage**: Leveraged existing client patterns instead of manual HTTP handling
- **Model Reuse**: Used existing `StationResponse` struct for `/playNotification` XML response parsing
- **Documentation Updates**: Added troubleshooting guide for speaker notification issues

## Feature Implementation Statistics

### API Endpoint Coverage Evolution

| Phase   | Endpoints Added | Cumulative Total | Completion %     |
|---------|-----------------|------------------|------------------|
| Phase 1 | 4               | 4                | 15%              |
| Phase 2 | 6               | 10               | 38%              |
| Phase 3 | 8               | 18               | 69%              |
| Phase 4 | 3               | 21               | 81%              |
| Phase 5 | 1               | 22               | 85%              |
| Phase 6 | 2               | 24               | 92%              |
| Phase 7 | 3               | 27               | 96%              |
| Phase 8 | 2               | 29               | 100%             |
| Phase 9 | 0               | 29               | 100% (Bug fixes) |

### Testing Evolution

#### Unit Test Coverage
- **Phase 1**: Basic HTTP client tests (25 tests)
- **Phase 2**: Media control and discovery tests (75 tests)
- **Phase 3**: Audio control tests (125 tests)
- **Phase 4**: System feature tests (150 tests)
- **Phase 5**: WebSocket event tests (200 tests)
- **Phase 6**: Zone management tests (250 tests)
- **Phase 7**: Advanced audio tests (300+ tests)
- **Phase 8**: Speaker notification tests (330+ tests)
- **Phase 9**: Bug fix verification tests (335+ tests)

#### Integration Test Coverage
- **Real Device Testing**: SoundTouch 10 and SoundTouch 20
- **Network Scenario Testing**: Various network configurations
- **Error Scenario Testing**: Device offline, network timeouts
- **Cross-Platform Testing**: Windows, macOS, Linux

### CLI Tool Evolution

#### Command Categories Added by Phase
- **Phase 1**: `info`, `name`, `capabilities`
- **Phase 2**: `discover`, `play`, `volume`, `key`
- **Phase 3**: `bass`, `balance`, `source`, `presets`
- **Phase 4**: `clock`, `network`
- **Phase 5**: `events`
- **Phase 6**: `zone`
- **Phase 7**: Advanced audio commands
- **Phase 8**: `speaker` (TTS, URL, beep notifications)
- **Phase 9**: Bug fixes (speaker beep reliability)

#### CLI Feature Enhancements
- **Host:Port Parsing**: Support for `192.0.2.100:8090` format
- **Auto-Discovery Integration**: Seamless device discovery
- **Formatted Output**: Human-readable, structured output
- **Error Handling**: Comprehensive error messages and recovery suggestions
- **Help System**: Comprehensive help and examples

## Technical Achievements

### Architecture Milestones
- **Clean Package Structure**: Well-organized pkg/ architecture
- **Interface-Based Design**: Testable and mockable components
- **Error Handling**: Comprehensive error types and contextual messages
- **Configuration System**: Flexible configuration via files and environment variables

### Performance Optimizations
- **Device Caching**: TTL-based caching for discovery performance
- **Connection Pooling**: Efficient HTTP connection management
- **WebSocket Efficiency**: Optimized real-time event handling
- **Memory Management**: Efficient XML parsing and model handling

### Cross-Platform Support
- **Multi-OS Compatibility**: Windows, macOS, Linux support
- **Build System**: Comprehensive Makefile with cross-compilation
- **Docker Support**: Containerized deployment options
- **WASM Preparation**: Foundation for browser integration

## User Experience Improvements

### Safety Features
- **Volume Warnings**: Warnings for high volume levels
- **Input Validation**: Comprehensive input range validation
- **Error Recovery**: Graceful handling of network issues
- **User Feedback**: Clear status messages and progress indicators

### Convenience Features
- **Auto-Discovery**: Automatic device finding
- **Preset Analysis**: Intelligent preset management
- **Source Shortcuts**: Direct source selection methods
- **Zone Management**: High-level multiroom operations

### Documentation Evolution
- **API Documentation**: Comprehensive endpoint documentation
- **Usage Guides**: Detailed feature usage guides
- **Troubleshooting**: Common issues and solutions
- **Examples**: Real-world usage examples

## Future Enhancement Roadmap

### Next Phase Candidates
- **Web Application Interface**: Browser-based SoundTouch controller
- **Home Assistant Integration**: Smart home platform integration
- **WASM Browser Library**: Pure browser implementation
- **Mobile App Development**: Native mobile applications
- **Docker Distribution**: Containerized deployment options

### Community Features
- **Plugin System**: Extensible architecture for community plugins
- **Custom Event Handlers**: User-defined event processing
- **Configuration Presets**: Shareable device configurations
- **Automation Scripts**: Scheduled playback automation

## Lessons Learned

### Development Insights
- **Real Device Testing is Critical**: API documentation doesn't capture all device behaviors
- **Safety First**: User protection features are essential for audio equipment
- **Progressive Enhancement**: Building features incrementally ensures solid foundation
- **Community Value**: Open source approach accelerates development and testing

### Technical Insights
- **XML Parsing Complexity**: SoundTouch API has quirks requiring careful XML handling
- **Network Variability**: Different network configurations require multiple discovery methods
- **Device Differences**: SoundTouch models have subtle API differences
- **WebSocket Reliability**: Real-time connections need robust reconnection logic

---

**This document tracks the evolution of the Bose SoundTouch API client from initial concept to production-ready library.**
