Using Siri with Twilio For Home Automation
Time to read: 2 minutes
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:
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.
- Indigo 4 Pro INSTEON-compatible Home Automation Software for Mac $179.98
- ApplianceLinc – INSTEON Plug-in Appliance On/Off Module, 3-Pin $34.99
- Venstar Thermostat – INSTEON Remote Control Thermostat 7-Day Programmable $199.99
- PowerLinc Modem – INSTEON USB Interface (Dual-Band) $79.99
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.
Related Posts
Related Resources
Twilio Docs
From APIs to SDKs to sample apps
API reference documentation, SDKs, helper libraries, quickstarts, and tutorials for your language and platform.
Resource Center
The latest ebooks, industry reports, and webinars
Learn from customer engagement experts to improve your own communication.
Ahoy
Twilio's developer community hub
Best practices, code samples, and inspiration to build communications and digital engagement experiences.