Makerprojects: Getting a toddler to automatically play music on a Sonos with NFC tags

Printing out NFC tags

After using my much loved Sonos Play:5 for a while I started thinking about how I could include it in my Smarthome project. This was before I got my hands on the Vera Lite and before my daughter Ada started crawling around. After watching her fiddle with my iPad and not really getting anywhere with it, except continously pressing the home button to exit whatever game I was trying to get her interested in. It was then I realized that however gifted one sees your own child Ada was not equipped with the motoric skills yet required to start her favourite songs for example on our livingroom Play:5 speaker. I have been itching to try a proper project with NFC tags out as I find the act of making something digital happen through physical interaction fascinating. I realized that physical NFC tags were the perfect way for her to interact with digital interfaces like starting a song she likes on the Sonos speaker. So how do you make this magic happen? Pay close attention after the break!

PS: Aren’t my self printed NFC tags awesome???

So what do you need? Actually a surprising amount of stuff.. but if you already have the Vera smart home gateway and a NFC capable phone then you’re almost there! And who doesn’t right??

Equipment list:
– NFC tags (I bought mine at
– A NFC capable phone (HTC One X and the Samsung Galaxy SIII support this)
– A Vera smart home gateway (I have the Vera Lite)
– The apps Tasker and Homebuddy from the Google Play store.
– The Sonos plugin for the Vera.

Various NFC-tags biught from

Various NFC-tags biught from

I assume you have your Vera up and running. Download the ZIP archive all the way at the bottom of this page (It’s tiny and hard to miss but it’s right above the blue footer.
Now like the good walkthrough zombie you are do this:
1. Log into your Vera managment interface through the login.
2. Click “Apps” and then click “Develop Apps”. No need to worry, the development is already done we just need to upload the plugins.
3. Click “Loop Files” and and upload all the files you downloaded (except the file D_Sonos1_UI4.json and the services subdirectory). check the Restart Luup after upload checkbox and click GO.
4. Now it’s time to create the Sonos device.
5. Click “Create Device” (It’s important that you click the create device under Develop Apps and not under the main Devices section as it will not work then.)
6. In the UpnpDevFilename input box enter D_Sonos1.xml
7. In the Description input box enter a name for the panel device, e.g. Sonos Living Room.
8. Click Create device
10. Exit the option you are now in and click on the Devices on the main link bar, here you will now see your newly created device. In the top right corner of the device click the wrench symbol to get into the settings menu for the specific device.
11. Click Advanced and enter the IP address of your Sonos Device, I added the IP address of my Play:5 speaker but I’m sure other choices will work as well. After saving you then get rewarded with a Sonos logo on the device, magic!

Before you proceed see if you can control your Sonos device through the buttons on the devicemenu.

Now we are ready to make the magic happen! What we need is that the mobile phone sends a signal to the Vera gateway when you tap a NFC-tag on it. This happens in the following way:

The NFC Task Launcher app recognizes that you have tapped a NFC tag on the phone, the NFC tag is tagged with a premade Tasker task which sends calls on the Homebuddy app to send a start scene signal to the Vera Getway. The Vera gateway then initiates the scene which in turn plays the music. All this happens in a very short time, confused?? I’ll split the next part into sections to make it simpler to follow:

Setting up the scene on the Vera Gateway:
1. Under Automation click New Scene.
2. Give the scene a name, such as Play Sonos
3. Select the [Advanced] option/tab
4. Select the Sonos device
5. Click (Add)
6. Then from the drop down options list created below, Choose PlayURI. You can now use SetURIToPlay and PlayURI callbacks to:
– load or play a Sonos playlist by its name => use URI SQ: is the name of your playlist
– load or play an audio input by its name => use URI AI: is the name of your audio input
– load or play the local audio input => use URI AI:
– load or play the local (internal) queue starting at the first track => use URI Q:
– load or play the local (internal) queue starting at the track => use URI Q:
I created a local playlist on my Sonos that I named Ada, so my PlayURI command was “SQ:Ada”. This was for testing purposes and as my project proceeds I will make separate song calls for every NFC-tag that I have.
7. Confirm Changes and then save.
8. Try your new scene from the administration panel and if successful we will now try to start it from the Homebuddy Android app.

This is the application I use on Android to remote control my Vera system. I would start with setting up this application and logging into your mios account and testing out the scene we created in the previous step, all systems go? Then it’s time to set up the Tasker app.

Tasker is an Android application that can automate pretty much anything you throw at it, it’s a powerful application with a user interface that is not for the feint of heart. This Youtube video explains the setup process better that words: You can find the scene number of the scene you created in the Vera gateway admin panel.

NFC Task Launcher:
Now that we have a tasker app that launches a Homebuddy scene we need to trigger the Tasker app with a NFC-tag. This is done with the NFC Task Launcher.
1. Open the NFC Task Launcher on your phone.
2. Click New Tag.
3. Click New Task.
4. Click Add Action.
5. At the bottom you have Tasker, click it and you will get an overview of the existing Tasker tasks that you have created. Choose the one you created in the previous step. Make sure you have followed the instruction about opening Tasker to external applications that you will receive when you add the Tasker task.
6. Finish the tutorial, write to the selected NFC-tag and you are DONE!


And here is my daughter trying it out:

My daughter playing music on the Sonos with NFC tags from Christian Haugen on Vimeo.