Add an Airsonic Music Server to Sonos

Adding your Airsonic Music Server to Sonos

So for a while I’ve been looking at ways to access my music collection on my NAS around the home. I’ve tried various software applications and packages, and then tried casting to various devices and speakers. To be honest it was a little hit and miss. I’d been using Airsonic for a while, but then found it lacking in a few features and it was quite buggy. I then made the switch over to Airsonic-Advanced which is a more actively developed fork and have had much better results with it. We have Sonos dotted around the home and I wanted a way to serve the content from my Proxmox server running on my Beelink GK Mini, to the Sonos ecosystem. Previously, I would just mount a share and point the Sonos library at it, but it was a bit hit and miss, and the browsing was very basic not to mention slow.

I did some research and finally managed to get the Airsonic “Sonos” integration working.

Here’s a quick tutorial on how I did it (I believe this will work for other variants of Airsonic, i.e. subsonic, madsonic etc.) Skip through if you’re already running Airsonic-advanced.

Install Airsonic-Advanced in Docker:

I used the stacks feature in Portainer to create a Docker Stack:

version: “2.1”
services:
  airsonic:
    image: lscr.io/linuxserver/airsonic-advanced
    container_name: airsonic_advanced
    restart: always
    logging:
      driver: json-file
    network_mode: bridge
    environment:
      – PUID=${PUID}
      – PGID=${PGID}
      – TZ=${TZ}
    volumes:
      – /docker/appdata/airsonic:/config
      – /etc/localtime:/etc/localtime:ro
      – /data/media/music:/music
      – /data/media/music/playlists:/playlists
      – /data/media//music/podcasts:/podcasts
    ports:
      – 4040:4040

My environmental variables point to a file I created in /etc/environment which basically automate the ‘IDs and TZ. You could easily replace that with the following (for example):

    environment:
      – PUID=1000
      – PGID=1000
      – TZ=Europe/London

Hit deploy, and wait for the container to spin up. If all is well, you should be able to browse to the container’s IP:4040. Create your login (default is admin) and set a password.

Next steps

  • Click the settings icon at the top and browse to Sonos.
  • Enable Sonos music service – check
  • Multi User – check
  • Make sure Root host address is filled out appropriately (be specific, is it http or https, make sure port is there too…
  • Input the Music service name i.e. “Airsonic”
  • Hit save, you’re done.
Airsonic Settings for Sonos
Airsonic Settings for Sonos

That’s it for the Airsonic side. Now we need to look to the Sonos side.

Creating a Music Service in Sonos

Browse to the URL that applies to one of your Sonos speakers using the following format:

http://sonos.speaker.ip.address:1400/customsd.htm

Now fill in the following information (you can use mine as a template):

Creating the Music Server in Sonos
Creating the Music Server in Sonos

Note the Version number fields. Be sure to fill those in.

192.168.2.76 represents the Sonos speaker, 192.168.2.251 represents the Container’s IP address (my Media server), 4040 is the default Airsonic port. Once done, submit the info above. If all is well you should be met with the following screen:

Airsonic Server Created Successfully
Airsonic Server Created Successfully

Adding the Airsonic Server as a source in Sonos

Now go to the sonos software and Add a new service (Manage > Service Settings > Add). You should now be able to see your Airsonic server in the list.

Finding the new Server in Sonos
Finding the new Server in Sonos

Next click through and “Start procedure to link my account.” Follow the instructions to authenticate (i.e. user/password which you created initially), and if all’s well, the service will be added to your list of Sources in the Sonos App.

It should pick up everything, including podcasts and playlists. Job Done!

The New Airsonic Server has been added
The New Airsonic Server has been added

What I am most impressed with is how snappy the browsing is. I mean compared to using the usual services (spotify, apple music, amazon music etc), the responsiveness is great.

I see no reason why you couldn’t run several different servers according to household members. You could run another container using a different port per person, and then add them as above (be sure to choose a different SID when you create the service via XML).

Here are the links that I used to make my way through the above:

https://github.com/airsonic-advanced/airsonic-advanced/blob/master/SONOS.md#2-adding-the-music-service-in-the-sonos-app

http://www.subsonic.org/pages/sonos.jsp 

Note there are some small differences on the subsonic set up, but else everything is pretty much as I outlined.

 

Consider this an entry level walkthrough! If you have any good ideas on how to utilise Airsonic or Sonos further, pop them in the comments below or come over to our facebook group to discuss further.

https://www.facebook.com/groups/386238285944105

If you’re considering a renovation and looking at the structured wiring side of things, or maybe you just want to support the blog, have a look below at my smarthome book, it’s available in all the usual places (including paperback)!

The Smarthome Book
The Smarthome Book

Leave a Reply