Documentation Index
Fetch the complete documentation index at: https://mintlify.com/benz206/SpotifyMacroBoard/llms.txt
Use this file to discover all available pages before exploring further.
Architecture overview
The Spotify MacroBoard uses a three-tier architecture to communicate with the Spotify API:- Performance: The personal server caches authentication tokens and handles OAuth flows, eliminating the need for the ESP32 to manage complex authentication
- Security: Sensitive credentials (client ID, client secret, refresh tokens) are stored on the server, not hardcoded in the ESP32
- Simplicity: The ESP32 only needs to make simple HTTPS GET requests with a password parameter
- Speed: Server-side caching and connection pooling significantly reduces response times
Communication flow
Control actions
When you press a button on the MacroBoard:- ESP32 detects the button press (src/src.ino:381-387)
- ESP32 sends an HTTPS GET request to
/api/manageState/{password}/{action} - Personal server receives the request and validates the password
- Personal server makes an authenticated request to Spotify Web API
- Spotify processes the action (play/pause, skip, volume change, etc.)
- Server returns a response to the ESP32
State synchronization
The MacroBoard polls for current playback state every 5 seconds:- ESP32 sends a request to
/api/getCurrent/{password}(src/src.ino:395-398) - Personal server queries Spotify’s current playback endpoint
- Server returns JSON with track info, playback state, and album art color
- ESP32 updates the OLED display and RGB LEDs (src/src.ino:247-289)
The 5-second polling interval (defined by
currentDelay at src/src.ino:25) balances real-time updates with ESP32 power consumption and API rate limits.HTTPS certificate authentication
The ESP32 uses certificate-based HTTPS to ensure secure communication with the personal server:SampleCredentials.h and must match the SSL certificate installed on your personal server. This prevents man-in-the-middle attacks and ensures the ESP32 only communicates with your trusted server.
Connection management
The ESP32 maintains a persistent HTTPS connection using HTTP Keep-Alive:Error handling
The MacroBoard provides visual feedback for different error conditions:| LED color | Meaning | Location |
|---|---|---|
| Red | Failed to connect to server | src/src.ino:196, 211 |
| Yellow | Request timeout (>5 seconds) | src/src.ino:225 |
| Orange | Invalid response format | src/src.ino:234 |
| Orange-red | OLED display initialization failed | src/src.ino:65 |
Password authentication
All API requests include a password parameter defined in your credentials file:The password is sent over HTTPS, so it’s encrypted in transit. However, make sure to use a strong, unique password that’s different from your Spotify credentials.
Next steps
Server setup
Learn how to set up your personal proxy server
API endpoints
Detailed reference for all API endpoints