Using Siri with Twilio For Home Automation

October 31, 2011
Written by
John Sheehan
Contributor
Opinions expressed by Twilio contributors are their own

Twilio Bug Logo

Christopher Deutsch of MakeRocketGoNow
Christopher Deutsch is a web developer and the owner of MakeRocketGoNow, a Minneapolis-based software development company specializing in web and mobile applications. 

I’ve created a Twilio, Node.js mash up that allows me to control appliances and the thermostat in my house using the iPhone 4S’s Siri voice recognition.

Here’s a demo of turning on my bedroom fan.

How does this work? From Siri to the end result the chain goes:

  1. Siri
  2. Twilio SMS number
  3. Node web application
  4. Indigo Web Server
  5. Insteon thermostat/appliance

Let’s go through the setup in reverse order in more detail.

Insteon and Indigo

I purchased the following items last year from Amazon to add some basic home automation to my house.

I have a Mac Mini I use as a server which is connected to the PowerLinc Modem via USB. The Indigo software communicates two-way with the Insteon devices in my home via the PowerLinc. In addition to a native iPhone app, the Indigo software has both a web interface and RESTful Api you can use to control your devices.

Node.js Web Application

The Node.js application is the middle man between Twilio and the Indigo web server. When Twilio POSTs the incoming SMS message to the Node app, it parses the message and determines the appropriate Api call to make on the Indigo web server. I wrote some semi-fuzzy logic so the phrases you use don’t have to be exact.

For hosting the Node app I picked Heroku because it’s convenient to use and free.

Twilio

Setting up Twilio was super easy. I created a Twilio account, purchased a phone number for $1/month, and entered the Url of my Node app that receives the incoming SMS messages.

Siri

To make communicating with my Twilio phone number easy I added a contact called “Gladys” (could be anything but I’m a Portal fan) and associated the Twilio number with her.

I can now control my appliances using the following commands:

  • Tell Gladys to set thermostat to 73
  • Tell Gladys to turn off the bedroom fan

I originally wanted to turn this into a public Siri to Url web service, but I question the demand for such a thing considering trying to make this “generic” would take a lot of time. So if you’re interested in adding Siri control to your own use case and don’t have programming skills, I’m available for hire and can whip you up something to suite your exact needs. ;)

Cross posted with permission from Christopher’s blog.