Build shairport sync with MQTT support on Raspberry Pi - idcrook/shairport-sync-mqtt-display GitHub Wiki
This is a tested path on Raspbian stretch
pre-reqs to build
https://github.com/mikebrady/shairport-sync/blob/master/INSTALL.md
sudo apt update
sudo apt upgrade
# install deps
sudo apt install -y build-essential git screen xmltoman autoconf automake \
libtool libdaemon-dev libpopt-dev libconfig-dev libasound2-dev avahi-daemon \
libavahi-client-dev libssl-dev libsoxr-dev libsndfile1-dev libmosquitto-dev
use the source, Todd
Clone the shairport-sync
repo if you haven't already
### screen or tmux is useful for slow builds
# screen
cd ~/projects
git clone https://github.com/mikebrady/shairport-sync.git
cd shairport-sync
shairport-sync
with systemd, metadata and MQTT support
build cd ~/projects/shairport-sync
autoreconf -fi
./configure --sysconfdir=/etc --with-configfiles \
--with-alsa --with-avahi \
--with-ssl=openssl \
--with-systemd \
--with-metadata --with-mqtt-client
make
sudo make install
shairport-sync
config file
configure # edit to configure /etc/shairport.conf (See below)
grep -v ^// /etc/shairport-sync.conf
# sudo cp -v /etc/shairport-sync.conf.sample /etc/shairport-sync.conf
sudo vi /etc/shairport-sync.conf
salient pieces of a working config file
metadata =
{
enabled = "yes"; // set this to yes to get Shairport Sync to solicit metadata from the source and to pass it on via a pipe
include_cover_art = "yes"; // set to "yes" to get Shairport Sync to solicit cover art from the source and pass it via the pipe. You must also set "enabled" to "yes".
};
mqtt =
{
enabled = "yes";
hostname = "mqttbrokerhost"; // Hostname of the MQTT Broker
port = 1883;
topic = "shairport-sync/rpih1"; //MQTT topic where this instance of shairport-sync should publish. If not set, the general.name value is used.
publish_parsed = "yes"; //whether to publish a small (but useful) subset of metadata under human-understandable topics
publish_cover = "yes"; //whether to publish the cover over mqtt in binary form. This may lead to a bit of load on the broker
enable_remote = "yes"; //whether to remote control via MQTT. RC is available under `topic`/remote.
}
- hostname
mqttbrokerhost
may need an entry in/etc/hosts
- topic needs to be consistent with topic configured for
app.py
Debug steps
# if outputting sound from this Pi, can list sound cards
aplay -l
shairport-sync
service
systemd startup for less /lib/systemd/system/shairport-sync.service
sudo systemctl force-reload shairport-sync
sudo systemctl enable shairport-sync
sudo systemctl status shairport-sync
sudo systemctl start shairport-sync
journalctl -u shairport-sync