The important part is the --backend pipe --device /home/pi/music/spotify part which tells Spotify connect to use a named pipe as output device. This named pipe has to be created before and of course should be located inside the library that forked-daapd is indexing.
if you include
# Watch named pipes in the library for data and autostart playback when
# there is data to be read. To exclude specific pipes from watching,
# consider using the above _ignore options.
pipe_autostart = true
in /etc/forked-daapd.conf then forked-daapd will automatically start the playback when librespot fills the pipe (that is when you select librespot in spotify as an output.
You can use whatever Remote app to select the speakers forked-daapd will stream to or you can use mpd to do so via a shell script.
I actually configured switches in home-assistant for that purpose:
@snizzleorg Do you only ever use your speaker with one account?
I would like to be able to share the speaker between me and my wife. She has her own Spotify Premium account.
I am thinking of starting up two librespot instances and pointing them to the same pipe (if this is possible). When my wife selects her speaker ‘chimpyWife_Speaker’, the Spotify HA component can trigger an automation on ‘playing’ and if source = ‘chimpyWife_Speaker’. The automation would pause my stream (if ‘playing’ to ‘chimpy_Speaker’) thus avoiding the two streams from overlapping.
Another automation would take of the other way around, when she is playing something and I wish to use the speaker.
edit
Just checked and named pipes can accept multiple inputs. Sweet. Time to test.
Yeah you can put in discovery mode but that’s not an acceptable solution to me because the Source in Hass eventually disappears whereas when you’re logged in it remains there permanently, even when it’s not locally available.
ok. that’s not an issue for me since I do not use it that much from HASS. I use Spotify through the built in support of forked-daapd mainly. Just sometimes when people come round and want to play something off Spotify that is not in my library I use librespot
This projects sounds really interesting, but I’m not sure it would work for my use-case. I’m looking for something that would allow me to control my iTunes library that’s on my PC (sadly, not a mac, so no API for it). I use smart playlists extensively, since I haven’t found any alternative that will let me use logic rules to sort my music, sync ratings, playcounts, and other metadata, and stream to my two Airport Express remote speakers.
Would this solution allow me to integrate Home Assistant with my iTunes located on my PC? Or, alternatively, could it be set up to point to an iTunes library on a NAS? I’m not familiar with Java or Python, so I’d like to get suggestions (or confirmation) from the community before I start messing with my setup.
This would be working if you can move your library to a NAS AND run forked-daapd instead of iTunes either on the NAS or some other linux computer (Raspberry Pi for example)
That’s amazing news! I’ll be able to test that out some time in the future, and see if I can figure it out. Thanks so much for letting me know. I’m assuming that I can run forked-daapd on the same rPi 3 that’s running HassIO, and that it can be installed using docker. Is this correct, or would I need to run it on a different linux machine?
Yeah you just have to think of forked-daapd as an iTunes server. It will manage your library and can output it to multiple Airplay speakers.
Unfortunately you need to use command line switches to control the outputs though and their individual volume because they are not yet in Hass (the point of this thread amongst other things).
I meant specifically regarding the API, whether there are now nicer ways of controlling which speakers were enabled, and their volume. Rather than through the CLI.
I put together a video on my YouTube channel showing how I set things up. Should be useful as a reference for setting up both forked-daapd itself, as well as integration into Home Assistant. The video description has a link to a notes document that I use as a reference.
Credit to this thread for motivating me to set this up!