Joris' blog

Using Homepod as Spotify Connect device

Spotify has a longstanding track record of putting itself in the position of the underdog and as a victim of an "unlevel playing field".
In my opinion this is just a tactic to hide their own shortcomings.
They have proven to be perfectly capable to try and violate your privacy and data rights, squeeze indie artists and monopolize the podcast ecosystem.

One of their many shortcomings is implementing support for Apple's HomePod.
Luckily the open source community came to the rescue...

What you will get

  • The HomePod as a Spotify Connect device.
  • Control playback from any Spotify Client (iOS App, Windows Desktop, iOS Control Center)
  • Spotify Premium "Very High" sound quality option (not that I can hear the difference)
  • There will be about ~3 seconds delay between the app and the HomePod.

What you need

  • A linux box (I used a Raspberry Pi that was already running Homebridge)
  • Between 5 and 20 minutes

Setup

The setup involves 2 daemons: SpoCon that acts as a Spotify Connect device and forked-daapd that forwards the audiostream to HomePod.




    ┌───────────┐     ┌──────────┐     ┌────────────────┐     ┌───────────┐
    │  Spotify  ◄─────►  SpoCon  ├─────►  forked-daapd  ├─────►  HomePod  │
    └─────▲─────┘     └──────────┘     └────────────────┘     └───────────┘
          │
          │
 ┌────────▼────────┐
 │   Spotify App   │
 └─────────────────┘

forked-daapd is an excellent open source project with a lot of other capabilities.
It even has its own Spotify support via libspotify, but it doesn't support Spotify Connect and will not show up in the Spotify apps without SpoCon.

Step-by-Step

  1. Install SpoCon. The README offers an easy 1-liner.
  2. Make named pipes for SpoCon's output using mkfifo. mkfifo /srv/music/spotify; mkfifo /srv/music/spotify.metadata
  3. Give access to SpoCon user: chown spocon: /srv/music/spotif*
  4. I changed the following in the SpoCon config file at /opt/spocon/config.toml (I didn't enter any spotify credentials):
deviceType = "SPEAKER"
deviceName = "Homebridge"

[player]
        enableNormalisation = true
        initialVolume = 5243
        releaseLineDelay = 20
        normalisationPregain = 3.0
        metadataPipe = "/srv/music/spotify.metadata"
        autoplayEnabled = true
        preferredAudioQuality = "VERY_HIGH"
        output = "PIPE"
        pipe = "/srv/music/spotify"
        logAvailableMixers = true
        volumeSteps = 64
  1. Install forked-daapd aka owntone-server. Raspberry Pi instructions here.
  2. (Re)Start the 2 daemons: service forked-daapd restart; service spocon restart
  3. Pair your HomePod with forked-daapd in the webinterface http://forked-daapd.local:3689/ under Settings > Remotes & Outputs.
  4. Set HomePod as the output of forked-daapd (bottom right in webinterface).

🎉 That's it!
The SpoCon client will show up in Spotify (under your value of deviceName).
Forked-daapd will automatically pick up the named pipe in /srv/music and forward the stream to the HomePod.

This is possible thanks to these great projects and their volunteers:

Not Spotify.

Example (Usage)

Screenshot

Playing status in Spotify (notice bottom left)

Screenshot

Playing status in iOS Control Center

Screenshot

Homebridge in list of Spotify Connect devices on iOS

Screenshot

Homebridge in list of Spotify Connect devices on Windows

- 3 toasts