A Flask web application that displays now-playing information from shairport-sync via MQTT and provides transport controls.
- Real-time display of currently playing track (title, artist, album)
- Album artwork display
- Transport controls (play/pause, previous, next, volume)
- Shows active AirPlay client name
- Clean, responsive web interface
- Python 3.9+
- Poetry for dependency management
- shairport-sync configured with MQTT metadata output
- An MQTT broker (e.g., Mosquitto)
-
Clone the repository:
git clone https://github.com/yourusername/shairport-mqtt-web.git cd shairport-mqtt-web -
Install dependencies:
make install
-
Copy the example config and edit with your settings:
cp config.yaml.example config.yaml
-
Edit
config.yamlwith your MQTT broker details:mqtt: host: "your-mqtt-broker" port: 1883 username: "" # if required password: "" # if required topic: "shairport" # must match shairport-sync config
make devmake prodThe web interface will be available at http://localhost:5001 (or the port configured in config.yaml).
To install as a systemd service on Linux (e.g., Raspberry Pi):
-
First, ensure you have configured
config.yamlwith your settings. -
Deploy and install the service:
make deploy
This will:
- Copy files to
/opt/shairport-mqtt-web - Create a Python virtual environment
- Install the systemd service
- Enable the service to start on boot
- Copy files to
-
Start the service:
sudo systemctl start shairport-mqtt-web
-
Check status:
sudo systemctl status shairport-mqtt-web
-
View logs:
sudo journalctl -u shairport-mqtt-web -f
To update and redeploy after making changes:
make redeployTo uninstall the service:
make uninstall-serviceNote: The service uses systemd's DynamicUser feature which creates a temporary user automatically.
Ensure your shairport-sync is configured to publish metadata via MQTT. Add the following to your shairport-sync configuration:
mqtt = {
enabled = "yes";
hostname = "your-mqtt-broker";
port = 1883;
topic = "shairport";
publish_cover = "yes";
enable_remote = "yes"; // for transport controls
};
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Main web interface |
/api/state |
GET | Current playback state as JSON |
/api/cover |
GET | Current album artwork |
/api/control/<command> |
POST | Send transport control |
play- Resume playbackpause- Pause playbackplaypause- Toggle play/pausenext- Skip to next trackprevious- Go to previous trackvolumeup- Increase volumevolumedown- Decrease volume
MIT
