A Flask-based server that allows you to play custom chime sounds on Sonos speakers using the Sonos Audio Clips API.
- Play custom MP3 chimes on any Sonos speaker
- Adjustable volume control
- Priority levels support (HIGH/LOW)
- Simple REST API interface
- Built-in chime file management
- Python 3.6+
- Flask
- requests
- A Sonos speaker with Audio Clips API support
- Clone the repository:
git clone https://github.com/yourusername/sonos-chime-server.git
cd sonos-chime-server
- Install dependencies:
pip install flask requests
- Set the host url where the server will be reachable:
export HOST="http://your-server-address:8080"
python app.py
The server will start on port 8080 by default.
docker run -d --name sonos-chime -p 8080:8080 -e "HOST=http://localhost:8080" ghcr.io/vchrisb/sonos_chime:0.1.0
curl -v --insecure \
-H 'X-Sonos-Api-Key:123e4567-e89b-12d3-a456-426655440000' \
https://192.168.1.100:1443/api/v1/players/local/info
GET /api/play_chime
Query Parameters:
playerIP
(required): IP address of the Sonos speakerplayerID
(required): ID of the Sonos playerchime
(optional): Name of the chime file without .mp3 extension (default: "doorbell1")volume
(optional): Volume level 0-100 (default: 30)priority
(optional): Priority level "HIGH" or "LOW" (default: "LOW")
Example:
curl "http://localhost:8080/api/play_chime?playerIP=192.168.1.100&playerID=RINCON_123456&chime=doorbell1&volume=50&priority=HIGH"
GET /api/list_chimes
Returns a list of available chime files.
Example:
curl "http://localhost:8080/api/list_chimes"
- Convert your audio file to MP3 format
- Place the MP3 file in the
chimes
directory - The filename (without .mp3 extension) will be used as the chime name in the API
The server uses the following configuration:
HOST
: Environment variable for the server's public URL (required)- Default port: 8080
- Default chime directory:
./chimes