A custom Home Assistant integration for controlling go-librespot media players.
This integration provides full media player control for your go-librespot daemon:
- Playback Control: Play, pause, stop, next/previous track
- Volume Control: Set volume levels with full range support
- Seek Control: Jump to any position in the current track
- Repeat Modes: Support for repeat off/all/one
- Shuffle Control: Enable/disable shuffle mode
- Media Information: Display current track, artist, album, and cover art
- Real-time Status: Instant WebSocket updates of playback state and track information
- Add this repository to HACS as a custom repository
- Install "Go Librespot" from HACS
- Restart Home Assistant
- Copy the
custom_components/go_librespotfolder to your Home Assistantcustom_componentsdirectory - Restart Home Assistant
- Go to Settings → Devices & Services
- Click Add Integration
- Search for "Go Librespot"
- Enter your go-librespot daemon details:
- Host: IP address or hostname of your go-librespot daemon
- Port: Port number (default: 24879)
- Name: Friendly name for the media player
The integration uses the following go-librespot API endpoints:
WS /events- Real-time status updates and events
GET /status- Get initial player status and track informationPOST /player/play- Start playback with new contentPOST /player/resume- Resume playbackPOST /player/pause- Pause playbackPOST /player/next- Skip to next trackPOST /player/prev- Skip to previous trackPOST /player/seek- Seek to positionPOST /player/volume- Set volume levelPOST /player/repeat_context- Toggle context repeatPOST /player/repeat_track- Toggle track repeatPOST /player/shuffle_context- Toggle shuffle mode
The integration uses WebSockets for instant status updates instead of polling. This provides:
- Instant Response: Changes are reflected immediately in Home Assistant
- Efficient: No unnecessary network traffic from polling
- Reliable: Automatic reconnection if the connection is lost
- Battery Friendly: Reduces power consumption on mobile devices
The integration listens for these real-time events from go-librespot:
active/inactive- Device activation statusmetadata- Track information updates (title, artist, album, cover art)playing/paused/stopped- Playback state changesseek- Track position changesvolume- Volume level changesshuffle_context/repeat_context/repeat_track- Playback mode changes
- Home Assistant 2023.1 or later
- go-librespot daemon running and accessible on your network
- Python aiohttp library (automatically installed)
- Ensure your go-librespot daemon is running and accessible
- Check that the host and port are correct
- Verify there are no firewall restrictions
- Test the API directly:
curl http://your-host:24879/status
- Restart Home Assistant after installation
- Check the logs for any error messages
- Ensure the integration files are in the correct directory structure
Feel free to submit issues and enhancement requests!
This integration is provided as-is under the MIT license.