This is a guide for Apple airplay users who wish to setup whole-house audio, with the ability to use the forked-daapd integration of homeassistant for automations and speaker selection, etc. This is working for me currently with Home Assistant core-2021.1.5, supervisor-2021.01.7 and Home Assistant OS 5.10 running on raspberry pi 4.
This documents how I have setup the forked-daapd server on the same rpi4 as homeassistant, and added shairport-sync so my iphone audio apps can be sent to multiple airplay speakers (ie āwhole-houseā), getting around the single speaker limitation of iOS/iPadOS/tvOS with airplay 1 speakers.
I rely on the portainer hassio addon to setup forked-daapd and shairport-sync docker containers.
These are sparse notes, I recommend reading up on how to use forked-daapd and shairport-sync in their respective github repositories.
Here are the docker-compose files for these, which can be pasted as āstacksā in portainer . In addition to pasting the docker-compose, be sure to name and deploy the stacks.
setup forked-daapd docker-compose:
version: "2"
services:
daapd:
image: linuxserver/daapd
restart: always
container_name: daapd
network_mode: host
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
volumes:
- /mnt/data/supervisor/share/daapd:/config
- /mnt/data/supervisor/share/music:/music
Add your music and playlist files to the /share/music directory (I use the hassio samba addon to do this). Edit the forked-daapd.conf file in /share/daapd, I use samba hassio addon and VScode editor. Uncomment the following to allow piped audio to autostart:
pipe_autostart = true
setup shairport-sync docker-compose:
version: "2"
services:
shairport:
image: mikebrady/shairport-sync
restart: always
container_name: shairport-sync
network_mode: host
devices:
- /dev/snd
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
volumes:
- /mnt/data/supervisor/share/music:/music
- /mnt/data/supervisor/share/shairport:/config
Once deployed, open a console window for the running shairport-sync container (you need to select /bin/sh as the command type). Copy the shairport-sync.conf file to your /share/shairport directory so you can edit as needed to enable pipe support and any other changes such as the shair-port name:
cp /etc/shairport-sync.conf /config
Edit the file to enable pipe support and pipe metadata support. Again, I use the samba hassio addon to access the file for editing (I use VScode editor in Windows). I use the filenames āshairā and āshair.metadataā for the two pipe files in the shairport-sync.conf file.
Uncomment and edit the pipe and metadata entries, hereās a partial example of the changes to make, make sure both the open and close (not shown) brackets for each section are uncommented:
general =
{
name = "Whole House"
output_backend = "pipe"
pipe =
{
name = "/music/shair";
metadata =
{
enabled = "yes";
pipe_name = "/music/shair.metadata";
Once the edits are made, copy back the file:
cp /config/shairport-sync.conf /etc
Now create the shair and shair.metadata files in the āmusicā directory, by executing each of these commands, one at a time:
cd music
mkfifo shair
mkfifo shair.metadata
chmod 777 shair*
Restart both the forked-daapd and shairport-sync containers (using portainer).
Now you should be able to add the forked-daapd server to homeassistant, and control your airplay speakers. You can access the forked-daapd web interface at port :3689. You should now see a shairport-sync speaker with the host name or whatever you named it in the shairport-sync.conf file (ie āWhole Houseā). Now you can send music from iOS/iPadOS/tvOS apps to multiple speakers you select in forked-daapd.
Hopefully this is a useful starting point for others!