A Sonos SMAPI implementation to allow registering sources of music with Sonos.
Support for Subsonic API clones (tested against Navidrome and Gonic).
- Integrates with Subsonic API clones (Navidrome, Gonic)
- Browse by Artist, Albums, Random, Favourites, Top Rated, Playlist, Genres, Years, Recently Added Albums, Recently Played Albums, Most Played Albums
- Artist & Album Art
- View Related Artists via Artist -> '...' -> Menu -> Related Arists
- Now playing & Track Scrobbling
- Search by Album, Artist, Track
- Playlist editing through Sonos app.
- Marking of songs as favourites and with ratings through the Sonos app.
- Transcoding within subsonic clone
- Custom players by mime type, allowing custom transcoding rules for different file types
- Localization (only en-US, da-DK, nl-NL & fr-FR supported currently, require translations for other languages). Sonos localization and supported languages
- Auto discovery of Sonos devices
- Discovery of Sonos devices using seed IP address
- Multiple registrations within a single household.
- SONOS S1 and S2 support
- Auto registration with Sonos on start for Sonos S1 devices
bonob is packaged as an OCI image to both the docker hub registry and github registry.
ie.
docker run docker.io/simojenki/bonobor
docker run ghcr.io/simojenki/bonob| tag | description |
|---|---|
| latest | Latest release, intended to be stable |
| master | Lastest build from master, probably works, however is currently under test |
| vX.Y.Z | Fixed release versions from tags, for those that want to pin to a specific release |
Unfortunately in May 2024 Sonos released an update to the Sonos S2 app that required bonob be exposed to the internet to continue to work on S2. S1 devices continue to work locally within youur network. There is a lengthy thread on the issue here.
The tldr; is:
- If you have devices that can be down graded to Sonos S1 then you can continue to use bonob within your network without exposing anything to the internet, support for this mode of operation will continue until Sonos themselves EOL S1.
- If you have devices that cannot be downgraded to S1 then you must use S2, in which case you need to expose bonob to the internet so that it can be called by Sonos itself. Exposing services to the internet comes with additional risk, tread carefully.
See below for instructions on how to set up bonob for S1 or S2.
See here
In order to use Sonos S2 you are going to need to expose your bonob service to the internet so that Sonos can hit it. You may wish to restrict your firewall (TCP/443 only) to the Sonos IP addresses outlined in here.
See here
| item | default value | description |
|---|---|---|
| BNB_PORT | 4534 | Default http port for bonob to listen on |
| BNB_URL | http://$(hostname):4534 | S1: URL (including path) for bonob so that Sonos devices can communicate. This can be an IP address or hostname on your local network, it must however be accessible by your Sonos S1 devices. ie. http://192.168.1.5:4534 S2: This must be the publicly available DNS entry for your bonob instance, ie. https://bonob.example.com |
| BNB_SECRET | undefined | Secret used for encrypting credentials, must be provided, make it long, make it secure |
| BNB_AUTH_TIMEOUT | 1h | Timeout for the Sonos auth token, described in the format ms, ie. '5s' == 5 seconds, '11h' == 11 hours. In the case of using Navidrome this should be less than the value for ND_SESSIONTIMEOUT |
| BNB_LOG_LEVEL | info | Log level. One of ['debug', 'info', 'warn', 'error'] |
| BNB_SERVER_LOG_REQUESTS | false | Whether or not to log http requests |
| BNB_SUBSONIC_URL | http://$(hostname):4533 | URL for subsonic clone |
| BNB_SUBSONIC_CUSTOM_CLIENTS | undefined | Comma delimeted mime types for custom subsonic clients when streaming. Must specify the source mime type and optionally the transcoded mime type. For example; If you want to simply re-encode some flacs, then you could specify just "audio/flac". However; if your subsonic server will transcode the track then you need to specify the resulting mime type, ie. "audio/flac>audio/mp3" If you want to specify many something like; "audio/flac>audio/mp3,audio/ogg" would use client = 'bonob+audio/flac' for flacs, and 'bonob+audio/ogg' for oggs. Disclaimer: Getting this configuration wrong will cause Sonos to refuse to play your music, by all means experiment, however know that this may well break your setup. |
| BNB_SUBSONIC_ARTIST_IMAGE_CACHE | undefined | Path for caching of artist images that are sourced externally. ie. Navidrome provides spotify URLs. Remember to provide a volume-mapping for Docker, when enabling this cache. |
| BNB_SCROBBLE_TRACKS | true | Whether to scrobble the playing of a track if it has been played for >30s |
| BNB_REPORT_NOW_PLAYING | true | Whether to report a track as now playing |
| BNB_ICON_FOREGROUND_COLOR | undefined | Icon foreground color in Sonos app, must be a valid svg color |
| BNB_ICON_BACKGROUND_COLOR | undefined | Icon background color in Sonos app, must be a valid svg color |
| BNB_LOGIN_THEME | classic | Theme for login page. Options are: 'classic' for the original timeless bonob login page. 'navidrome-ish' for a simplified navidrome login page. '@wkulhanek' for more 'modernized login page'. |
| TZ | UTC | Your timezone from the tz database ie. 'Australia/Melbourne' |
| item | default value | description |
|---|---|---|
| BNB_SONOS_DEVICE_DISCOVERY | true | Enable/Disable Sonos device discovery entirely. Setting this to 'false' will disable Sonos device search, regardless of whether a seed host is specified. |
| BNB_SONOS_SEED_HOST | undefined | Sonos device seed host for discovery, or ommitted for for auto-discovery |
| BNB_SONOS_SERVICE_NAME | bonob | S1 service name for Sonos, doesn't seem to apply for S2 setups |
| BNB_SONOS_SERVICE_ID | 246 | service id for Sonos |
| BNB_SONOS_AUTO_REGISTER | false | Whether or not to try and auto-register with S1 devices on startup. For S2 ensure that this is false. |
The simplest transcoding solution is to simply change the player ('bonob') in your subsonic server to transcode all content to something Sonos supports (ie. mp3 & flac)
Disclaimer: The following configuration is more complicated, and if you get the configuration wrong Sonos will refuse to play your content.
In some situations you may wish to have different 'Players' within your Subsonic server so that you can configure different transcoding options depending on the file type. For example if you have flacs with a mixture of frequency formats where not all are supported by Sonos See issue #52 & Sonos supported audio formats
In this case you could set;
# This is equivalent to setting BNB_SUBSONIC_CUSTOM_CLIENTS="audio/flac>audio/flac"
BNB_SUBSONIC_CUSTOM_CLIENTS="audio/flac"This would result in 2 players in Navidrome, one called 'bonob', the other called 'bonob+audio/flac'. You could then configure a custom flac transcoder in Navidrome that re-samples the flacs to a Sonos supported format, ie Using something like this or this:
ffmpeg -i %s -af aformat=sample_fmts=s16|s32:sample_rates=8000|11025|16000|22050|24000|32000|44100|48000 -f flac -Note for Sonos S1: 24-bit depth is only supported by Sonos S2, so if your system is still on Sonos S1, transcoding should convert all FLACs to 16-bit:
ffmpeg -i %s -af aformat=sample_fmts=s16:sample_rates=8000|11025|16000|22050|24000|32000|44100|48000 -f flac -Alternatively perhaps you have some aac (audio/mpeg) files that will not play in Sonos (ie. voice recordings from an iPhone), however you do not want to transcode all everything, just those audio/mpeg files. Let's say you want to transcode them to mp3s, you could set the following;
BNB_SUBSONIC_CUSTOM_CLIENTS="audio/mpeg>audio/mp3"And then configure the 'bonob+audio/mpeg' player in your subsonic server.
-e BNB_ICON_FOREGROUND_COLOR=white \
-e BNB_ICON_BACKGROUND_COLOR=darkgrey-e BNB_ICON_FOREGROUND_COLOR=chartreuse \
-e BNB_ICON_BACKGROUND_COLOR=fuchsia-e BNB_ICON_FOREGROUND_COLOR=lime \
-e BNB_ICON_BACKGROUND_COLOR=aliceblue-e 'BNB_ICON_FOREGROUND_COLOR=#1db954' \
-e 'BNB_ICON_BACKGROUND_COLOR=#121212'version: "3"
services:
navidrome:
image: deluan/navidrome:latest
user: 1000:1000 # should be owner of volumes
ports:
- "4533:4533"
restart: unless-stopped
environment:
# Optional: put your config options customization here. Examples:
ND_SCANSCHEDULE: 1h
ND_LOGLEVEL: info
ND_SESSIONTIMEOUT: 24h
ND_BASEURL: ""
volumes:
- "/tmp/navidrome/data:/data"
- "/tmp/navidrome/music:/music:ro"
bonob:
image: simojenki/bonob:latest
user: 1000:1000 # should be owner of volumes
ports:
- "4534:4534"
restart: unless-stopped
environment:
BNB_PORT: 4534
# ip address of your machine running bonob
BNB_URL: http://192.168.1.111:4534
BNB_SECRET: changeme
BNB_SONOS_AUTO_REGISTER: "true"
BNB_SONOS_DEVICE_DISCOVERY: "true"
BNB_SONOS_SERVICE_ID: 246
# ip address of one of your sonos devices
BNB_SONOS_SEED_HOST: 192.168.1.121
BNB_SUBSONIC_URL: http://navidrome:4533As discussed here and here, there is an issue playing tracks via cloudflare. Until otherwise resolved the current 'solution' is to "disable CF proxy feature and leave DNS-only for bonob.example.com record". (Note you may need to wait some time for DNS caches to propogate)
- Icons courtesy of Navidrome, Vectornator, and @jicho
- Sonos S2 setup documentation and navidrome images courtesy of @wkulhanek
- Sonos S2 support courtest of everyone involved with issue 205



