Integrating multiple Spotify Accounts and Home Assistant

Hi,

thanks for the great work you are doing here! I have a setup of different RaspPi3bs running Volumio and some snapcast clients running without Volumio on other machines, bringing sound to all rooms. I am integrating this into my Home Assistant (works in principle). And I really love it!

As we are different people here in the house, all listening to different music and all having our own spotify account, I wonder how to set this up best.

What do I want to achieve?
With Home Assistant I can track which rooms (and hence which speakers / snapclients) are currently “owned” by which user of my family. Now I would like to dynamically switch the audio output to the stream of the new user of this room, when the owner changes. Be this webradio or spotify. Of course everyone should listen with their own spotify account.

I cannot find a how-to for this, so I would appreciate some guidance here. I found hints about installing different instances of librespot (which I wouldn’t know how to do), thought about setting up individual volumio instances for different users (and tying spotify to this, but being unable to switch the snapclients dynamically to new host)… So, I am stuck. Any ideas how to tackle this in principle and in detail?

Thanks!

[Edit]
Kind of obviously I would like to have a single spotify connect option for each spotify user - connecting to the stream of that user, having all the magic of where this gets played be done by Home Assistant.

And I am aware of https://www.home-assistant.io/blog/2016/02/18/multi-room-audio-with-snapcast/ - but this doesn’t tackle the multiple spotify accounts, other than I likely need one server with mopidy input streams per spotify account. How ever I can achieve this.

Hi,

You seem to be savvy enough, so I can theoretically explain the option that comes to mind. Theoretically as I haven’t tested this :wink:

You can have one SnapServer serve multiple streams, you can assign players to specific streams on a particular server. So in theory you could server multiple vollibrespot streams and give them recognisable names. At least I think… as said, never tried this. But if you can configure a single (vol)librespot binary to a stream, why not multiple? :slight_smile:

In theory I think I understand where I need to go: Define multiple Spotify inputs for the snappserver - but in practice I don’t even know what to search for to get ideas how to actually do it.

I would still be very thankful for any help on practically doing this!

Hi,

In theory the syntax is:
-d -s spotify://{vollibrespot location}?name={stream name}&devicename={device name in Spotify}&bitrate={bitrate}&username={Spotify username}&password={Spotify passwd} … second stream, separated by a space and starting with -s (you only need to declare -d once, since it has nothing to do with the streams).

Example:

-d -s spotify:///usr/bin/vollibrespot?name=FirstStream&devicename=Stream1&bitrate=320&username=account1&password=pwd1 -s spotify:///usr/bin/vollibrespot?name=SecondStream&devicename=Stream2&bitrate=320&username=account2&password=pwd2

Source: github.com/badaix/snapcast/blob … md#spotify

Cheers