Smart Home Announcement System with Sonos

sonos play 1I’ve previously posted a video that demonstrated the capability of text to speech (TTS) with Sonos Play 3. This was achieved by installing the Sonos Pluginin Vera. However, I found the response time of the setup rather inconsistent. On top of that, after updating the plugin to the latest version, it didn’t work on my Vera anymore. This post shows how you can run Sonos command using PHP. At this point I think I’ve lost all the non-geeks but yes, this post is only for geeks. 🙂

As I’ve recently purchased an Intel NUC, I’ve decided to shift the TTS functionality to the windows machine for processing the TTS commands on Sonos via PHP instead. What you need to do is to first install WampServer, followed by the downloading the readily available Sonos PHP class files from DjMomo Github. Then I wrote a simple php file that takes the message and send to the Sonos. For example, I can make tasker or any other sub system to make a http call:

intel-htpc-nuc/sonos/speak.php?message=hello this is sonos

You can even set the volume, send the message to specific Sonos. The good thing is if you are playing music on Sonos, the music will fade out, play the TTS message and resume playing the music. I found it very useful to for my wife to use it as a PA system to summon me into the room without shouting from the room 🙂 I’ve simply created a bookmark on her iPhone with the URL:

intel-htpc-nuc/sonos/speak.php?message=get your ass back to the room dearie, please come to the room

With this text to speech capability detached from Vera, I can simply use tasker or scenes in Vera to send announcement message during scene activation as shown below:

Screen Shot 2014-07-08 at 9.00.23 PM

So this is how it goes during morning sun:

And I used this TTS announcement when testing the Fibaro Motion Sensor in my previous post:

In fact, the functionalities provided by DjMomo Sonos class includes almost the entire range of commands you can do on a regular Sonos app but so far I’m only interested in the TTS command. Feel free to try this out and l’m more than happy to help.

Domotics

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.