Your Sonos Can Speak To You
Following up on my previous post, in which I hooked up a Griffin PowerMate to a Raspberry Pi to control a Sonos, I wanted to write about a pretty cool enhancement: using the same PowerMate, you can scroll through your favorites, having them spoken to you by your Sonos, and select the favorite you want to play. Let's look at a video to see how it works:
This is accomplished by grabbing and caching our list of favorites at startup (and when the favorites change), and making a callout to the tts-api service, which will turn text strings into downloadable mp3 files. We send our Favorites strings, one-by-one, to the tts-api service, and download the provided mp3 files.
When the Sonos isn't playing, a double-press of the PowerMate will put the system in Favorites mode. Here, your favorites are announced as you rotate the dial back and forth. At this point, a single press will play the currently-selected favorite. A double press, or waiting 30 seconds, will exit Favorites mode.
Again, the source can be found at github, and my previous post can help with installation. Check it out, and let me know what you think.