How to set up a full house audio system with X streams and Y speakers

I just finished a full house setup with multiple stream playback using mopidy, mpd, spotify and Iris all integrated Home Assistant. Full how to documentation is on the Home Assistant forum. From those instructions a visual of the project

Cool, thanks for cross-posting here. I really like how seemlessly iris integrated into the HA web interface. I had always aimed to do something just like for Pi Musicbox (RIP) but I should have just used HA!

A few suggestions:

As previously mention I installed mopidy on a PI3, because the spotify library isn’t available for the PI4

libspotify has always worked on Pi 4, providing you use the normal 32-bit version of Raspberry Pi OS. To install Mopidy-Spotify the easy way (i.e. not the way you’ve documented) install from apt.mopidy.com and then sudo apt install mopidy-spotify.

To run an application that access spotify you have to go to this web site login and create an app.

You don’t need to do that. The client_id and client_secret you require are obtained from Mopidy-Spotify

The versions of Mopidy, snapserver and snapclient from Debian archives are quite told. You are much better off using the latest versions. For Mopidy that’s installing from apt.mopidy.com and for snapcast that’s detailed here.

I’m a little surprised you don’t run into problems as all your copies of Mopidy are using the same caching directories. Despite your efforts to create one each in the service unit, you didn’t tell them to actually use it e.g in /etc/mopidy/mopidy1.conf you’d want:

[core]
cache_dir = /var/cache/mopidy1

Thanks for the feedback. I’ll building out another copy of this for a family member in the next week or two and will look at making your adjustments.

kingosticks are you of the opinion that I could move the SD card from my PI 3 to a PI 4 and it would just work, or do you think I’d have to do a full build out?

I looked in the mopidy cache directory and it only contains a spotify directory. Is it possible that the way the spotify code uses that directory their isn’t an issue with multiple instances dropping stuff in that location? As it’s cache I’m wondering if maybe there is some benefit to the multiple instances sharing the cache? I’m going to add the cache_dir as recommended, but wanted your thoughts on collision issues. I thought I saw somewhere in this forum mention only being able to playback one stream from spotify. If that’s true I don’t that limitation as I have things installed. So I was thinking that maybe sharing the cache might be why I don’t see that limitation.

The last question has to do with building play list. It doesn’t seem there is a great option available. However a reasonable approach is to use Iris to build a music queue. The queue shows up as the active playlist in ncmpcc, where I can enter ‘S’ and name the playlist to be saved. I don’t know if ncmpcc or mopidy is actually saving the playlist. I’m wondering if you know a command I can execute at the command line to cause the saving of the playlist in a specified filename. I want to do “SOMECOMMAND MOPIDY_PORT# FILENAME” to cause the file to be saved. If I can do this then I can add an option on HA where you enter the filename and push a button to save the current queue.

Thanks

Yes. But what stuff ends up in there entirely depends on the extension What might be fine for Mopidy-Spotify could be bad for Mopidy-Foo. And the same potentially applies to sharing a data directory across instances.

Maybe… but this would be pure luck and unreliable. I don’t think this is a good idea.

I thought I saw somewhere in this forum mention only being able to playback one stream from spotify

Yes. This is/was a per-account limitation from Spotify which meant each account could only stream one thing at a time. This is/was enforced by Spotify. If they’ve removed that restriction it’ll work just fine. I don’t think the cache directory has any impact on this restriction but I’m guessing.

Mopidy can save m3u playlists of the current tracklist contents.

mpc --port 6601 save my_playlist_name

Then load it with:

mpc --port 6601 load my_playlist_name

Nick,
I added the cache item to the instructions, made references to your point on the PI4 and spotify library install and added a way from the HA interface to save a playlist. The interface could be cleaner, but for a quick way to get the ability to save a play list it can’t be beat. Thanks for the input.

As it doesn’t appear Iris is friendly to playing pod cast any chance you have a suggestion on how I might pull pod cast into the implementation?

Nah, it isn’t. I use a different frontend when I want to listen to podcasts. I use Mopidy-Mobile.