Documentation for controlling and preserving Bose SoundTouch devices
This document outlines the concept for simulating and replacing upstream Bose services with enhanced state management capabilities. The goal is to create a comprehensive local replacement that can handle device lifecycles, account management, and state synchronization while maintaining compatibility with existing SoundTouch devices.
data/
├── accounts/
│ ├── {account-id}/
│ │ ├── account.json # Account metadata
│ ├── account-events.log # High-level account behavior tracking
│ │ ├── devices/
│ │ │ └── {device-id}/
│ │ │ ├── lifecycle.json # Device state and history
│ │ │ ├── info.xml # Device information
│ │ │ ├── presets.xml # Device presets
│ │ │ ├── recents.xml # Recent plays
│ │ │ ├── sources.xml # Configured sources
│ │ │ └── events.log # Device event history
│ │ └── sessions/
│ │ └── {session-id}/ # Recorded interaction sessions
└── system/
├── discovery.log # Device discovery events
└── migration.log # Migration activities
{
"id": "account-12345",
"name": "User Account",
"email": "user@example.com",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T15:45:00Z",
"status": "active",
"device_count": 3,
"migration_status": {
"started_at": "2024-01-18T09:00:00Z",
"devices_migrated": 1,
"devices_pending": 2,
"mirror_active": true
},
"bose_account_id": "bose-original-id",
"data_sources": {
"local": true,
"bose_mirror": true,
"primary": "bose"
}
}
{
"device_id": "A81B6A536A98",
"account_id": "account-12345",
"state": "active",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T16:22:00Z",
"state_history": [
{
"from": "unregistered",
"to": "registering",
"timestamp": "2024-01-15T10:30:00Z",
"reason": "fresh_device_setup",
"source": "discovery"
},
{
"from": "registering",
"to": "active",
"timestamp": "2024-01-15T10:35:00Z",
"reason": "registration_complete",
"source": "system"
}
],
"metadata": {
"name": "Living Room Speaker",
"type": "SoundTouch 30",
"serial_number": "I6332527703739342000020",
"firmware_version": "4.8.1.25341.2677643.1597353330",
"mac_address": "A8:1B:6A:53:6A:98",
"ip_address": "192.168.1.100",
"last_seen": "2024-01-20T16:20:00Z",
"is_legacy_id": false
},
"data_sources": {
"presets": "local",
"recents": "mirror_primary",
"sources": "local"
},
"migration": {
"from_bose_account": "bose-account-xyz",
"migrated_at": "2024-01-18T14:30:00Z",
"method": "gradual",
"rollback_available": true
}
}
# Device Events Log - A81B6A536A98
# Format: TIMESTAMP|EVENT_TYPE|SOURCE|DATA
2024-01-20T16:15:00Z|now_playing|websocket|{"source":"SPOTIFY","track":"Song Name","artist":"Artist Name"}
2024-01-20T16:15:30Z|volume_changed|websocket|{"volume":45,"muted":false}
2024-01-20T16:16:00Z|preset_selected|websocket|{"preset":1,"source":"SPOTIFY","location":"spotify:track:123"}
2024-01-20T16:18:00Z|disparity_detected|mirror|{"endpoint":"/v1/account/full","local_hash":"abc123","upstream_hash":"def456"}
2024-01-20T16:20:00Z|device_online|discovery|{"ip":"192.168.1.100","method":"mdns"}
# Parity Analysis Log
# Format: TIMESTAMP|ENDPOINT|DEVICE|ACCOUNT|DISPARITY_TYPE|DETAILS
2024-01-20T16:18:00Z|/v1/account/full|A81B6A536A98|account-12345|content_mismatch|preset_count:local=5,upstream=4
2024-01-20T16:19:15Z|/v1/presets|A81B6A536A98|account-12345|xml_structure|missing_container_art_in_local
2024-01-20T16:20:30Z|/v1/recents|A81B6A536A98|account-12345|timestamp_format|local=RFC3339,upstream=custom
# Create account explicitly
POST /api/v1/accounts
Content-Type: application/json
{
"name": "User Account",
"email": "user@example.com"
}
# Get account with migration status
GET /api/v1/accounts/{account-id}
# Initiate account migration from Bose
POST /api/v1/accounts/{account-id}/migrate
Content-Type: application/json
{
"bose_account_id": "bose-original-id",
"strategy": "gradual"
}
# Register fresh device
POST /api/v1/accounts/{account-id}/devices
Content-Type: application/json
{
"device_id": "A81B6A536A98",
"name": "Living Room Speaker",
"registration_type": "fresh"
}
# Get device state and lifecycle
GET /api/v1/accounts/{account-id}/devices/{device-id}/state
# Migrate device from Bose account
POST /api/v1/accounts/{account-id}/devices/{device-id}/migrate
Content-Type: application/json
{
"from_bose_account": "bose-account-xyz",
"preserve_data": true
}
# Get disparity analysis
GET /api/v1/system/disparities?since=2024-01-20T00:00:00Z
# Get migration status
GET /api/v1/system/migration/status
# Export account data
GET /api/v1/accounts/{account-id}/export
golangci-lint run --fixgo test ./... for each milestonegolangci-lint run --fix without issuesgo test ./... before proceedingFuture improvements should maintain the simplicity-first approach:
This concept provides a solid, maintainable foundation for replacing Bose’s upstream services. The emphasis on simplicity, existing system reuse, and comprehensive testing ensures reliable functionality while maintaining the debugging capabilities needed for small hardware deployments.