Kevin Cupp

SiriProxy with TiVo

I never thought Apple would come out with something that would make the “app experience” seem tedious. By app experience, I mean: going to your home screen, finding the right app, opening the app, then tapping your way to your objective, and heaven forbid you have to type anything long along the way. That description, which was the same even before Siri, makes it sound tedious, yet we never really thought of it as so until Siri came out. Now, a simple sentence can be translated into any number of taps to get a task done. Powerful possibilities now, and in the future.

The question is, how powerful? Apple has not yet provided a Siri SDK, but the question can now be answered sooner thanks to a couple of tinkerers that ultimately led to the creation of SiriProxy.

SiriProxy has matured a lot since its conception about two weeks ago, and is now fairly easy to get set up in your own home network. So, I decided to give it a shot last night and within about 1-2 hours1, I had Siri talking to my TiVo2:

It’s an awesome feeling knowing you’ve just done something that’s probably never been done before3. Not only that, this solved an actual need. Every now and then, we walk by our TiVo and see both tuners are recording shows and we’re curious what it’s recording4. Now, it’s just a question away.

The dream is to eventually be able to schedule recordings on the TiVo, (“Siri, record the next new episode of Mythbusters”) but that may remain a dream unless I can come up with a web service to submit TiVo’s online forms for scheduling shows.

But, these dreams are now that much closer. Here are some awesome examples of things people are doing with SiriProxy:

  • Thermostat control - The original SiriProxy plugin by @plamoni. Get the temperature of your house and make adjustments if needed.
  • Universal remote - I’d love to take this a step further and integrate it with my Logitech Harmony One remote. I would say, “I want to watch a DVD”, and watch my entertainment system switch TV inputs and turn on my DVD player.
  • IMDB reference - This is a great example of querying for information. It can tell you who was in a movie, or even make a recommendation based on the IMDB rating.
  • That’s what she said - This is just hilarious.

That second example made the use of an Arduino board. I plan on using one to have Siri open my garage (“Open my garage door”, “Is my garage door open?”, “Close it, please”). I could also perform another first and integrate Siri with the Wings-a-Loft system to open the doors on my DeLorean.

How does SiriProxy work?

While we await an official Siri SDK, SiriProxy gives us a look at patterns Siri uses to parse information and have a conversation. Let’s take a look.

listen_for /test siri proxy/i do
  say "Siri Proxy is up and running!"

Once the speech objects are parsed, SiriProxy gives you a chance to act on certain words or a phrase before Apple handles it. The above example is akin to “hello world.” The script listens for “Test Siri proxy” and then tells the user that it’s working. Now, let’s say you want Siri to ask a question:

listen_for /siri proxy test question/i do
  response = ask "Is this thing working?" # Ask the user for something

  if (response =~ /yes/i) # Process their response
    say "Great!" 
    say "You could have just said 'yes'!"
  request_completed # Always complete your request! Otherwise the phone will "spin" at the user!

You can see we use the “ask” command to prompt for data, then we use an if statement to figure out what to do with the answer. This is great for getting input or confirmation from the user, but it’s not the best way for Siri to follow a conversation. For example, you may ask Siri, “Where’s the best Chinese food?”, and then follow up with, “How about Mexican?” This is achieved with states.

listen_for /siri proxy test state/i do
  set_state :some_state
  say "I set the state, try saying 'confirm state change'"


listen_for /confirm state change/i, within_state: :some_state do
  say "State change works fine!"
  set_state nil # Clear out the state!

In the first listen_for statement, we set a state. Then in the second listen_for statement, we act on the phrase only if the previous state was set, allowing the conversation to flow.

For the last example, I’ll show how easy it is to grab data out of a sentence sent to Siri:

listen_for /siri proxy number ([0-9,]*[0-9])/i do |number|
  say "Detected number: #{number}"

Yes, you can use the power of regular expressions to listen to and act on phrases. This is really the key to figuring out the meaning of a sentence, a key value of Siri, rather than relying on the user using a specific syntax.

SiriProxy has raised the bar in terms of what we should expect in an SDK from Apple. It’s confirmed we’re not just looking for ways to tweet or add to-do items to our favorite to-do app, we want to interact with the things and information around us. This means Apple has to be willing to let Siri run any (approved) code thrown at it, which should be an interesting decision to see made. There are already apps to control your TiVo or thermostat, they just need this extra way of executing their code.

  1. This includes everything from the research on the XML TiVo provides of the shows it has recorded to getting SiriProxy up and running.
  2. I wanted to share the code on GitHub, but TiVo requres Digest authentication and it turns out there's no easy way to do this in Ruby without installing a gem, I didn't want users to have to do that. So right now, the code executes a PHP script that executes a curl shell command. Kind of a Rube Goldberg series of events, not ideal.
  3. At least, it's safe to assume given the time SiriProxy has been out and the lack of discussion online about a TiVo implementation.
  4. O' how I miss the TiVo Series 3's OLED display on the front that would tell you what it was recording. We now have the TiVo Premiere since the Series 3 was on its last leg, so now the time of day and what our TiVo is recording is often a mystery.