A Sonos SMAPI implementation to allow registering sources of music with Sonos.
Support for Subsonic API clones (tested against Navidrome and Gonic).
BNB_BROWSE_BY_FOLDER)bonob is packaged as an OCI image to both the docker hub registry and github registry.
docker run docker.io/simojenki/bonob
#or
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 |
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.
The tldr; is:
SONOS_ENABLE_S1=true| 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:4534S2: 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_LOG_HTTP_REQUESTS | false | Whether or not to log http requests |
| BNB_SUBSONIC_URL | http://$(hostname):4533 | URL for subsonic clone |
| BNB_SUBSONIC_TRANSCODE | true | Whether to use the OpenSubsonic Transcoding extension when the server supports it. Set to 'false' to disable automatic transcoding negotiation and always use the legacy stream path. |
| BNB_SUBSONIC_CUSTOM_CLIENTS | undefined | This probably should not be used any more, it would be better to use a subsonic server that supports the transcoding extensions, see BNB_SUBSONIC_TRANSCODE. 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_BROWSE_BY_FOLDER | false | Adds a 'Folders' menu for browsing your music by its folder structure. Requires a Subsonic server that exposes the actual folder tree (such as Gonic). Navidrome only returns a simulated Artist/Album tree, which duplicates the 'Artists' menu. Folders holding tracks themselves show up as albums and can be played, which queues their tracks and then those of their sub-folders, up to 500 tracks. Folders holding only sub-folders can be browsed but not played. |
| 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' |
These will have no effect if you do not set BNB_SONOS_ENABLE_S1=true
| item | default value | description |
|---|---|---|
| BNB_SONOS_ENABLE_S1 | false | Enables S1 support, disabled by default as new installations are predominantely S2, and having S1 config options is confusing people and causing support overhead. |
| 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. |
If your Subsonic server supports the OpenSubsonic Transcoding extension (Navidrome 0.61.0+), bonob will automatically negotiate the right transcoding decisions with the server using a Sonos-specific capability profile.
This is the recommended approach for handling unsupported audio formats (e.g. high sample rate FLAC). The Sonos profile bonob sends declares the supported sample rates (≤48kHz), bit depths, and channels — the server then decides whether to direct play or transcode each track based on these capabilities. No manual BNB_SUBSONIC_CUSTOM_CLIENTS configuration is required.
Important: When using this approach, ensure the bonob player in your Subsonic server has no Transcoding profile assigned and no Max Bit Rate cap. A server-side player override would replace bonob's capability profile and prevent the extension from working correctly.
If the server does not support the extension (e.g. older Navidrome versions), bonob automatically falls back to the legacy /rest/stream flow described below.
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_SUBSONIC_URL: http://navidrome:4533
Content type
Image
Digest
sha256:f433b2ed9…
Size
162.6 MB
Last updated
about 2 months ago
docker pull simojenki/bonob