How to integrate Amazon Echo and Sonos

Sonos is a fantastic product, the speakers sound great and no one has done multi-room audio better. Having said that, it does have a minor annoyance - the Sonos app. It does a decent job of managing the connected services and speakers, but searching for and playing music sometimes involves too many steps.

So when Sonos announced integration with Amazon Echo late 2016, I immediately bought an Echo Dot. Echo devices are not officially supported in Australia, so to setup there was some 'hackery' involved but process wasn't difficult. Since the announcement howerver, owners of these devices have been waiting for the Sonos/Echo integration without an official word on timeline.

So, if like me, you are too impatient for the beta to drop and want to control your Sonos speakers with voice commands right now, here are a few options.

Option 1: The Easy Option

You will need

  • an Amazon Echo Dot
  • Sonos Play:5
  • 3.5mm male-to-male audio cable

Steps

  1. Plug one end of the audio cable into the Play:5 and the other end into Echo Dot. For best results, keep them at-least 3ft apart, further the better.
  2. Using the Sonos app, set the Play:5 to line-in and enable AutoPlay
    • Launch the Sonos app on your phone or tablet, tap the menu in the top left corner
    • Scroll to the last option in the menu, tap on Settings, tap on Room Settings
    • On the next screen, tap the Sonos device that your Echo Dot is plugged into (for example, mine is named Kitchen)
    • Tap Line-In
    • Tap Autoplay Room and select the name of your Sonos device
  3. That's it, all audio from Echo Dot will now streams through your Sonos speaker.

How well does it work?

As long you're operating within the confines of music services supported by Amazon on the Echo, you'll be happy. Voice commands to control music only work if you have Spotify or Amazon Prime music.

You do not get control over your Sonos music integrations, so if you have Apple Music, Google Play Music or any other non supported service, this is not the best option.

You also cannot group or switch rooms.

Option 2: Sonos API with IFTTT

Alexa, trigger big beats in the kitchen

You will need

  • Amazon Echo (any)
  • Sonos device (any)
  • an always on computer capable of running node.js (RasPi, NAS, Mac/PC)
  • to be comfortable with terminal/command line

    Steps

    1. Setup jishi's node-sonos-http-api on a computer on the same network as your Sonos. A RasPi is a great device for this or run this on your NAS through docker. (I have this running on a QNAP NAS)

    For this to work, computer must be always on and accessible over the web. To find out how to enable this, look for instructions here.

    When you're able to reach http://your-ip-address:5005/zones and get a response back, move to the next step.

    1. Create Favourites or Playlists in your Sonos app
    2. Log in (or sign up) to IFTTT
      • Click on My Applet > New Applet
      • Click on +this
      • Choose Amazon Alexa as the service
      • Choose Say a specific phrase as the trigger
      • Type in a phrase e.g. big beats in the kitchen
      • Click on Create Trigger
      • Click on +that
      • Choose Maker as the action service
      • Choose Make a web request as the action
      • In the URL field, enter the sonos-api url as like so -http://your-ip-address:5005/kitchen/favorite/bigbeats
      • Choose method Get
      • Click Create Action
      • Click Finish
    3. Say "Alexa trigger big beats in the kitchen", the favourite "bigbeats" should start playing in the kitchen.
    4. You now have limited control of Sonos with Alexa.

Follow the above steps to create applets for each favourite/playlist that you want to trigger through Alexa.

The URL format to follow is http://your-ip-address:5005/{room name}/favorite/{favorite name} or http://your-ip-address:5005/{room name}/playlist/{playlist name}

For other actions such as pause/play the URL format is http://your-ip-address:5005/{room name}/{action}

e.g.

  • Classic rock in the lounge (http://your-ip-address:5005/lounge/favorite/classicrock)
  • Pink floyd in the bedroom (http://your-ip-address:5005/bedroom/playlist/pink floyd)
  • To pause, use a phrase like "living room stop" http://your-ip-address:5005/living room/pause

Checkout node-sonos-http-api for more examples.

How well does it work?

Surprisingly well, provided you have a manageable number of devices and have created favourites and playists in the Sonos app. You also cannot group or switch rooms as long you have the right triggers created and remember the trigger phrases.

The downside is that it's not dynamic, i.e. you have create a trigger for every action you want to perform which can and will get messy.

Option 3: Connecting with an Alexa Skill

Alexa, ask Sonos to play playlist history of rock

You will need

  • Amazon Echo (any)
  • Sonos device (any)
  • an always on computer capable of running node.js (RasPi, NAS, Mac/PC)
  • to be extremely comfortable with terminal/command line

Steps

This is based on Ryan Graciano’s echo-sonos repository where he has provided very clear instruction on how to set this up. But before you start, below are the steps at a high level of what you'll need to do.

  1. Setup jishi's node-sonos-http-api on an always-on computer accessible over the web.
  2. Create a free Amazon Developer account.
  3. Create an Alexa Skill (this will not be published and will remain in test mode)
  4. Configure the AWS Lambda servers to talk to the Alexa Skill and your home server running the Sonos API.
  5. You're done.

These steps above are an oversimplification, it took me over an hour to do and I know may way around the command-line. Just remember, if something doesn't seem like it's working, you can just wipe it all out and start again. When you get it working, rejoice - you've just achieved voice control over your Sonos system.

How well does it work?

Extremely well. The ability to say, “Alexa, tell Sonos to play playlist history of rock in the kitchen” or “Alexa, tell Sonos to add the lounge to the kitchen.” is pure bliss, and it mostly works.

Everything is configured dynamically, the zones, playlists, favourites and you can also group or switch rooms.

I highly recommend setting this up So, head over to rgraciano's echo-sonos repository and follow the instructions. If you run into trouble, let me know at @tchdhry, I may be able to help you out.