Lockitron + Evernote + Twilio

 

I recently purchased a Lockitron internet connected door lock.  The lock itself is pretty neat, but not without it’s problems.  I funded the Kickstarter campaign for this thing about two years ago.  I just recently received the lock.  So to say they have been behind schedule is a vast understatement.  I’m pretty sure that their small development team bit off much more than they could chew.  It probably took me at least a week to get the weatherstripping around my door correctly.  If it pressed too heard against the door, the lock wouldn’t work.  Too lightly against the door, and the outside was coming in (not a very energy efficient way to operate).

Now that I’ve gotten the physical configuration completed, I was excited to test out the SMS control.  Lockitron does provide a pretty good mobile app for the device, but when I want to give friends and family access to the lock, I didn’t really want to force them to have to download and install a new app.  And from the start of the Kickstarter campaign, SMS control was touted as a great way to give access to your lock without giving anyone a key.  Upon investigation, SMS control is available.  For $5/mo.  That seemed a little pricey to me, so I decided to brew my own.

First, I determined that I wanted both my wife and myself to be able to add and remove people from the authorized SMS list.  I also wanted it to be easy for either of us to update, from anywhere.  We’ve both huge fans of Evernote.  I thought that we could share a notebook together and then use a note to add SMS users.  It works perfectly.  If you’re following at home, create a new shared notebook in Evernote.  The name isn’t important, but mine is called ‘Lockitron’.  Now create a new note.  Again the name isn’t important.  I’m super creative, so my note is titled ‘Authorized Numbers’.   Now, if you’re using the Windows Evernote app, right-click on the note, click on ‘Copy share URL’ and make note of this URL.  If you’re using the web client or another OS, you’re on your own.  This is the format that is used in the note:

#2125221234, Jim
#2125221789, Joe
#2126449890, Bob

Now we have a common repository of numbers that will have access to my door.  Or your door.  Part one done.

Next up, we need to setup an SMS number for your Lockitron.  For that, we’ll be using Twilio.  Twilio provides a programatic way to interface with SMS.  You text the Twilio number and it does stuff.  So sign up on their site to get your new SMS number.  I thought it would be cute to get a phone number that ended in L-O-C-K.  Funny right?  What I didn’t think about is that when you text a number, its a full alphanumeric keyboard, not the phone dial pad – so its impossible to know what numbers L-O-C-K stands for.  Ooops.

The next part needed is the API keys for your specific Lockitron.  They can be found here: https://api.lockitron.com/.  You’ll need the lock ID and the token.  That part was easy.

Continuing on, you’ll need to edit the attached PHP script to include your Evernote URL, Lockitron ID, and Lockitron access token.  You’re also welcome to laugh at my code.  It’s probably terrible.  Once that is complete, upload the script to your favorite web host.  Oh yeah, you’ll need a web host.  This can be on some shared host you have access to, or your own webserver at home.

And the final piece of the puzzle is to plug the URL of your PHP script into Twilio.  the URL should go into the field for ‘Request URL’.  You now should have the ability to send three different commands to your lock’s Twilio SMS number.  I think they should be self explanatory:
LOCK
UNLOCK
STATUS

Happy hacking

 

Attachments:

http://steg.s3.amazonaws.com/files/lockitronControl.php