Commit Graph
14 Commits
Author SHA1 Message Date
Tobias Gesellchen 9f980765f5 feat: Add comprehensive zone management for multiroom control
- Implement GET /getZone and POST /setZone endpoints
- Add complete zone models with validation and error handling
- Create zone builder pattern for fluent API construction
- Add all zone operations: create, add, remove, dissolve
- Implement zone status queries and member management
- Add comprehensive CLI support for all zone commands
- Create 100+ tests covering all zone functionality
- Add WebSocket zone event handling and monitoring
- Include extensive documentation and examples
- Update project completion to 90% (18/20 endpoints)

BREAKING: None - all additions are backward compatible
NEW ENDPOINTS: /getZone (GET), /setZone (POST)
NEW CLI COMMANDS: -zone, -zone-status, -zone-members, -create-zone,
                  -add-to-zone, -remove-from-zone, -dissolve-zone
2026-01-09 11:41:14 +01:00
Tobias Gesellchen cc39efc882 feat: Add comprehensive WebSocket events support
- Implement real-time WebSocket client for device monitoring
- Add 12 event types: NowPlaying, Volume, Connection, Preset, Zone, Bass, Clock, Name, Error, Recents, Language
- Create WebSocket demo CLI with event filtering and auto-discovery
- Add comprehensive WebSocket documentation and examples
- Implement automatic reconnection and robust error handling
- Add 50+ WebSocket-specific tests with mock server
- Update project completion to 85% (16/19 endpoints)
- Clarify that POST /presets is officially not supported by SoundTouch API
- Add production-ready WebSocket client with configurable options

Breaking: WebSocket events require gorilla/websocket dependency
Docs: Complete WebSocket integration examples and API reference
2026-01-09 11:30:35 +01:00
Tobias Gesellchen 609cc04c16 Complete preset management implementation
- Add comprehensive preset reading functionality with helper methods
- Implement GetNextAvailablePresetSlot() and IsCurrentContentPresetable()
- Add CLI support for viewing presets with -presets flag
- Fix Preset XML tag to use lowercase 'preset' for API compliance
- Update documentation to reflect official API design:
  * GET /presets: fully implemented with rich analysis
  * POST /presets: officially 'N/A' per Bose documentation (not supported by design)
- Add detailed PRESET-MANAGEMENT.md documentation
- Update API endpoints overview and project status
- All tests passing with real device validation

Preset management is now 100% complete according to official API specification.
Read operations provide comprehensive preset analysis, while creation
is intentionally handled by official app/hardware controls per API design.
2026-01-09 11:11:10 +01:00
Tobias Gesellchen 46b7f3c6e7 feat: Add system endpoints for clock/time management and network info
- Implement GET/POST /clockTime endpoints for device time management
- Implement GET/POST /clockDisplay endpoints for clock display configuration
- Implement GET /networkInfo endpoint with real API structure
- Add comprehensive models for ClockTime, ClockDisplay, and NetworkInformation
- Update NetworkInformation to match real SoundTouch API responses:
  * WiFi interfaces with SSID, frequency, signal strength, and connection state
  * Ethernet interfaces with connection state
  * Proper attribute-based XML structure matching actual device responses
- Add CLI support for all system endpoints with detailed output formatting
- Add comprehensive test coverage for all new models and client methods
- Update documentation to reflect real API structure and capabilities
- Anonymize all personal data (IP addresses, device IDs, device names)
- Add SYSTEM-ENDPOINTS.md documentation with real-world examples

Features:
- Clock time sync with current system time or specific timestamps
- Clock display configuration (enable/disable, format, brightness, auto-dim)
- Rich network interface information with WiFi signal quality and frequency bands
- Support for both WiFi and Ethernet SoundTouch devices
- Validated against real SoundTouch 10 and SoundTouch 20 device responses

All tests pass and builds successfully.
2026-01-09 10:24:32 +01:00
Tobias Gesellchen b7b856b98f feat: implement balance control (GET/POST /balance)
- Add complete balance control functionality via GET/POST /balance endpoints
- Implement GetBalance() for current stereo balance retrieval
- Add SetBalance() with range validation (-50 to +50)
- Include IncreaseBalance() and DecreaseBalance() with safety limits
- Add SetBalanceSafe() with automatic value clamping
- Create comprehensive balance models with validation and helpers
- Add CLI flags: -balance, -set-balance, -inc-balance, -dec-balance
- Implement left/right percentage calculation and human-readable descriptions
- Create comprehensive test suite (30+ test cases) with mock servers
- Add error handling for devices that don't support balance control
- Update documentation with complete balance control reference
- Update API endpoints status (GET/POST /balance:  Implemented)
- Update project status (70% overall completion, 100% control endpoints)
- Complete audio management trilogy: Volume + Bass + Balance
- Real device testing shows device-dependent feature availability
- XML request/response format validation and compliance
- Human-readable balance descriptions (Far Left, Center, Right, etc.)
- Left/Right channel percentage display for better UX
2026-01-09 09:37:57 +01:00
Tobias Gesellchen 16b3be1950 feat: implement bass control (GET/POST /bass)
- Add complete bass control functionality via GET/POST /bass endpoints
- Implement GetBass() for current bass level retrieval
- Add SetBass() with range validation (-9 to +9)
- Include IncreaseBass() and DecreaseBass() with safety limits
- Add SetBassSafe() with automatic value clamping
- Create comprehensive bass models with validation and helpers
- Add CLI flags: -bass, -set-bass, -inc-bass, -dec-bass
- Implement safety features with range validation and clamping
- Create comprehensive test suite (30+ test cases) with mock servers
- Add integration tests with real device validation (SoundTouch 10/20)
- Update documentation with complete BASS-CONTROLS.md guide
- Update API endpoints status (GET/POST /bass:  Implemented)
- Update project status (55% overall completion, 80% control endpoints)
- Real device testing with bass adjustment and validation
- Error handling for invalid ranges and API responses
- XML request/response format validation and compliance
- Human-readable bass level descriptions and categorization
2026-01-09 09:22:57 +01:00
Tobias Gesellchen 65a46fd958 feat: implement source selection (POST /select)
- Add complete source selection functionality via POST /select endpoint
- Implement SelectSource() with all source types (SPOTIFY, BLUETOOTH, AUX, etc.)
- Add convenience methods: SelectSpotify(), SelectBluetooth(), SelectAux(), SelectTuneIn(), SelectPandora()
- Add SelectSourceFromItem() for working with SourceItem objects
- Add CLI flags: -select-source, -source-account, -spotify, -bluetooth, -aux
- Create comprehensive test suite (30+ test cases) with mock servers
- Add integration tests with real device validation (SoundTouch 10/20)
- Update documentation with complete SOURCE-SELECTION.md guide
- Update API endpoints status (POST /select:  Implemented)
- Update project status (50% overall completion, 60% control endpoints)
- Real device testing with Spotify and TuneIn source selection
- Error handling for invalid sources and API responses
- XML request format validation and compliance
2026-01-09 09:09:42 +01:00
Tobias Gesellchen e46f050e45 Complete key controls implementation with all 24 documented keys
Enhanced Key Support:
• Expanded from 13 to 24 total key commands
• Added power and system controls (POWER, MUTE)
• Added rating controls (THUMBS_UP, THUMBS_DOWN, BOOKMARK)
• Added playback mode controls (SHUFFLE_OFF/ON, REPEAT_OFF/ONE/ALL)
• Added input controls (AUX_INPUT)
• Organized keys into logical categories for better documentation

CLI Enhancements:
• New direct command flags: -power, -mute, -thumbs-up, -thumbs-down
• Enhanced help output with categorized key listing
• Updated flag descriptions to show all available keys
• Added practical examples for new key commands

Technical Improvements:
• Updated IsValidKey() validation for all 24 keys
• Enhanced GetAllValidKeys() to return complete key set
• Comprehensive test coverage for all new key constants
• Proper error handling and validation for new commands

Real Device Testing:
• POWER command tested successfully on SoundTouch device
• MUTE command tested successfully on SoundTouch device
• All new keys follow proper press+release pattern
• Maintains backward compatibility with existing commands

Documentation Updates:
• API-Endpoints-Overview.md - Complete categorized key reference
• KEY-CONTROLS.md - Enhanced with all playback, rating, and system controls
• STATUS.md - Updated project status to reflect completed key implementation
• CLI help output shows all 24 keys with usage examples

Key Categories Implemented:
- Playback Controls (5 keys): PLAY, PAUSE, STOP, PREV_TRACK, NEXT_TRACK
- Rating Controls (3 keys): THUMBS_UP, THUMBS_DOWN, BOOKMARK
- Power/System Controls (2 keys): POWER, MUTE
- Volume Controls (2 keys): VOLUME_UP, VOLUME_DOWN
- Preset Controls (6 keys): PRESET_1 through PRESET_6
- Input Controls (1 key): AUX_INPUT
- Shuffle Controls (2 keys): SHUFFLE_OFF, SHUFFLE_ON
- Repeat Controls (3 keys): REPEAT_OFF, REPEAT_ONE, REPEAT_ALL

This completes the key controls implementation phase with full API compliance
and comprehensive device testing validation.
2026-01-09 08:58:23 +01:00
Tobias Gesellchen f4c71eaa53 Add comprehensive mDNS/Bonjour discovery with unified service and diagnostic tools
Features Added:
• mDNS/Bonjour discovery using hashicorp/mdns library
• Unified discovery service combining UPnP + mDNS + configuration
• Parallel discovery execution for optimal performance
• Comprehensive logging for both UPnP and mDNS discovery
• Network diagnostic tools for troubleshooting

New Discovery Methods:
• Configuration-based (fastest, most reliable)
• UPnP/SSDP discovery (widely supported, enhanced logging)
• mDNS/Bonjour discovery (Apple ecosystem friendly)

New Programs & Tools:
• cmd/example-mdns - Standalone mDNS discovery testing
• cmd/example-upnp - Isolated UPnP/SSDP discovery testing
• cmd/mdns-scanner - Network diagnostic tool for mDNS services

Enhanced Build System:
• make dev-mdns / dev-mdns-verbose (mDNS testing)
• make dev-upnp / dev-upnp-verbose (UPnP testing)
• make dev-scan-all (scan all network services)
• make dev-scan-soundtouch (scan for SoundTouch services)

Documentation:
• docs/DISCOVERY.md - Comprehensive discovery guide
• Updated README.md with new features and commands
• Full API documentation and troubleshooting guide

Technical Improvements:
• Detailed request/response logging for UPnP M-SEARCH
• Step-by-step mDNS service discovery tracking
• IP address resolution with IPv4/IPv6 handling
• Service name parsing and device info extraction
• Robust error handling and network diagnostics

Backward Compatibility:
• No breaking changes to existing APIs
• All existing tests pass
• CLI interface unchanged but enhanced
• Legacy UPnP-only service still available
2026-01-09 08:49:33 +01:00
Tobias Gesellchen b4e6ce7042 feat: implement GET/POST /volume endpoints with press+release key pattern
Volume Control Implementation:
• Complete GET/POST /volume endpoint implementation with XML models
• Volume model with validation, clamping, and safety features
• Client methods: GetVolume(), SetVolume(), IncreaseVolume(), DecreaseVolume()
• CLI commands: -volume, -set-volume, -inc-volume, -dec-volume with safety limits
• Comprehensive volume level categorization and helper methods

Key Controls Enhancement:
• Fix press+release pattern: SendKey() now sends both press and release states
• Follows API documentation requirement for proper key simulation
• Add SendKeyPressOnly() and SendKeyReleaseOnly() for advanced usage
• Update documentation to reflect press+release behavior
• Add test for press+release pattern validation

Safety Features:
• Volume warnings for levels >30 with 2-second delay
• Increment/decrement limits (10 up, 20 down per command)
• Automatic volume clamping to 0-100 range
• Clear volume level descriptions (Mute, Quiet, Medium, High, Loud)

Testing & Documentation:
• Comprehensive volume control tests (30+ test cases)
• Complete documentation in docs/VOLUME-CONTROLS.md
• Updated key controls documentation for press+release pattern
• Real device testing with both SoundTouch 10 and 20
• All tests pass, no diagnostics errors

Real Device Integration:
• Fixed volume key press issues through proper press+release cycle
• Tested volume API endpoints with actual devices
• Safe volume levels maintained during testing

Breaking Changes: None
Backward Compatibility: Fully maintained

Production Ready:
 Volume control endpoints (GET/POST /volume)
 Enhanced key controls with proper press+release pattern
 Comprehensive safety features for volume management
 Real device validation and testing
2026-01-08 23:56:17 +01:00
Tobias Gesellchen 7d73da7986 feat: implement POST /key endpoint for media controls with host:port parsing
Major Features:
• POST /key endpoint implementation with XML model and validation
• Comprehensive media control commands (play, pause, stop, volume, presets)
• Automatic host:port parsing in CLI for improved UX
• Production-ready with full test coverage

Key Control Implementation:
• Add Key model with XML marshaling and validation (pkg/models/key.go)
• Support all standard keys: PLAY, PAUSE, STOP, PREV_TRACK, NEXT_TRACK, VOLUME_UP/DOWN, PRESET_1-6
• Client methods: SendKey(), Play(), Pause(), Stop(), VolumeUp(), VolumeDown(), SelectPreset()
• CLI commands: -play, -pause, -stop, -next, -prev, -volume-up, -volume-down, -preset, -key
• Critical fix: Use 'Gabbo' as sender (only accepted value by SoundTouch API)

Host:Port Parsing Enhancement:
• Support -host 192.168.178.28:8090 format in addition to separate -host/-port flags
• Robust parsing with IPv4, IPv6, and hostname support
• Graceful fallback for invalid input
• Backward compatible with existing usage

Testing & Documentation:
• Comprehensive unit tests for key functionality and host:port parsing
• Integration tested with real SoundTouch 10 and SoundTouch 20 devices
• Complete documentation in docs/KEY-CONTROLS.md and docs/HOST-PORT-PARSING.md
• All tests pass, no diagnostics errors

Breaking Changes: None
Backward Compatibility: Fully maintained

Tested with:
• SoundTouch 10 (192.168.178.28:8090) 
• SoundTouch 20 (192.168.178.35:8090) 
2026-01-08 23:46:34 +01:00
Tobias Gesellchen de2ff3550f Implement /name, /capabilities, and /presets informational endpoints
## New Endpoints

### GET /name 
- Simple device name retrieval with XML parsing
- Helper methods for name validation and display
- Real device name integration with anonymization

### GET /capabilities 
- Comprehensive device capabilities detection
- Complex XML structure with nested network, DSP, and system configurations
- Smart categorization: System Features, Audio Features, Network Features
- Capability-specific helper methods (HasLRStereoCapability, HasDualModeNetwork, etc.)
- Extended capabilities parsing with URLs and metadata

### GET /presets 
- Complete preset management with timestamps and metadata
- Spotify playlist integration with anonymized account information
- Smart filtering: by source, used/empty slots, most recent, oldest presets
- Comprehensive analysis: preset summaries with source breakdowns
- Time-based operations: creation/update timestamps with formatted display

## Device Introspection Features

### Capability Detection
- System capabilities: Light Switch, Clock Display, BCO Reset, Power Saving
- Audio capabilities: L/R Stereo support, DSP Mono/Stereo availability
- Network capabilities: Dual Mode, WSAPI Proxy, Hosted WiFi Configuration
- Extended capabilities: Custom endpoint discovery with URL mapping

### Preset Analysis
- Usage pattern analysis (used vs empty slots)
- Source distribution (Spotify, TuneIn, etc.)
- Temporal analysis (most recent, oldest presets)
- Content metadata extraction (artwork URLs, display names)

## Enhanced CLI Tool

### New Commands
- Added -name command with simple device identification
- Added -capabilities command with categorized feature display
- Added -presets command with comprehensive preset analysis
- Enhanced help system with all new command examples

### Rich Output Formatting
- Capability categorization with bullet-point display
- Preset timeline with creation/update timestamps
- Smart metadata display (artwork, source accounts, content types)
- Device-specific feature highlighting (different capabilities per device)

## Real Device Integration

### Multi-Device Testing
- Device 192.168.178.28: SoundTouch 10 with Light Switch, Clock Display, Hosted WiFi
- Device 192.168.178.35: SoundTouch 20 with L/R Stereo, Dual Mode networking
- Verified capability differences between device models
- Real preset data with anonymized Spotify account information

### Edge Case Handling
- Non-responsive endpoints (/trackInfo timeout handling)
- Empty preset configurations
- Missing capability sections
- Device-specific feature variations

## Quality & Testing

### Comprehensive Test Coverage
- 15+ unit tests for XML models with real device response patterns
- Client integration tests with mock HTTP servers
- Edge case validation (empty names, missing capabilities, no presets)
- Timestamp parsing and validation with Unix epoch conversion

### Production-Ready Features
- Type-safe XML unmarshaling with custom validation
- Robust error handling for network and parsing failures
- Privacy protection with anonymized real device data
- Documentation updates with real-world usage examples

## API Coverage Progress

 Complete Information Endpoints:
- GET /info - Device information
- GET /name - Device name
- GET /capabilities - Device capabilities
- GET /presets - Configured presets
- GET /now_playing - Current playback status
- GET /sources - Available audio sources

🔄 Next Phase - Control Endpoints:
- POST /key - Media controls
- GET/POST /volume - Volume management
- WebSocket / - Real-time events

Features:
 Comprehensive device introspection and capability detection
 Smart preset management with timeline analysis
 Multi-device support with hardware-specific feature detection
 Production-ready error handling and data validation
 Rich CLI interface with categorized output formatting
 Real device integration with privacy-protected test data
2026-01-08 23:32:18 +01:00
Tobias Gesellchen 5caad90d51 Implement /now_playing and /sources endpoints with real device integration
## New Endpoints

### GET /now_playing 
- Rich XML models with PlayStatus, ShuffleSetting, RepeatSetting enums
- Comprehensive playback information (track, artist, album, artwork, position)
- Device capabilities (skip, seek, favorite functionality)
- Smart display methods for different content types (music vs radio)
- Duration formatting with position/total time display

### GET /sources 
- Complete audio source management with SourceStatus enum
- Source categorization (Local/Remote, Streaming, Multiroom support)
- Multiple account support (multiple Spotify accounts per device)
- Availability filtering (Ready vs Unavailable sources)
- Helper methods for quick capability checks

## Real Device Integration

- Fetched actual XML responses from SoundTouch devices (192.168.178.28 & 192.168.178.35)
- Updated all test fixtures with real device data (anonymized)
- Enhanced XML models to handle all real-world fields and edge cases
- Verified compatibility across different device types and configurations

## Enhanced CLI Tool

- Added -nowplaying command with rich formatted output
- Added -sources command with categorized source listing
- Display enhancements: duration info, capabilities, source attributes
- Improved build process to use ./build/ directory consistently

## Comprehensive Testing

- 15+ unit tests for XML models with enum validation
- Client integration tests with mock HTTP responses
- Real device response validation
- Edge case handling (empty states, network errors, invalid data)

## Documentation & Guidelines

- Updated CLAUDE.md with build directory and real device testing guidelines
- Enhanced README with comprehensive usage examples
- Updated PLAN.md to reflect implementation progress
- All examples use real device data patterns

## Quality Improvements

- Type-safe XML unmarshaling with custom validation
- Consistent error handling across all endpoints
- Privacy protection (anonymized account information)
- Production-ready code structure and patterns

Features:
 GET /info - Device information
 GET /now_playing - Current playback status with full metadata
 GET /sources - Available audio sources with smart categorization
 UPnP device discovery
 Cross-platform CLI tool with rich output formatting
 Comprehensive test coverage with real device data
 Build automation with proper directory structure
2026-01-08 23:21:01 +01:00
Tobias Gesellchen 7de6b8246b Initial commit: Bose SoundTouch API Client PoC
- Implement HTTP client with XML support for SoundTouch Web API
- Add UPnP device discovery with SSDP protocol
- Create type-safe Go models for API responses
- Build CLI tool with device discovery and info commands
- Add comprehensive configuration management via .env and env vars
- Include extensive documentation (API endpoints, patterns, development guide)
- Translate all German documentation to English
- Set up modern Go project structure with testing framework
- Add Makefile for cross-platform builds and development workflow

Features:
 Device discovery (UPnP + manual configuration)
 Device information retrieval
 XML request/response handling
 CLI interface with flexible device targeting
 Cross-platform compatibility
 Comprehensive test coverage with mock data
 Production-ready configuration management
2026-01-08 23:01:32 +01:00