Notifications, Geofencing, Scheduling, Sense/Bluetooth


This is a real long post, documenting what I’m doing with my (virtual) Lockitron so far. Hopefully this gives some folks some inspiration for different things they can do with the API and similar.

So right now I’m testing my virtual locks with IFTTT on my iPhone 5, and a variety of notification systems, such as Boxcar, Pushover,, and even IFTTT’s own built in notifications.

I’ve noticed that the Locktiron Preview channel seems to be very fast for polling, much faster than the typical 15 minute delay that most IFTTT channels have built in (I guess this is due to Webhooks being available).

So far it’s working pretty well, since my virtual locks are “always on”. I’ve been able to set geofences around my house in IFTTT to have Lockitron be unlocked automatically when I enter the zone, and to have Lockitron lock when I leave the zone. Checking the status of the virtual locks in the app shows that they are in the expected status each time one of these triggers fires.

My hope is to have my location trigger my real Lockitron (when I get it) to start waking up, and eventually unlock/lock it automatically as I enter/leave (until Sense becomes available).

There are a couple of approaches I have in mind here. There’s also Pebblock and SmartWatch+ for my Pebble, but I haven’t explored that approach yet, and at that point I would probably just open the app on my phone.


I was previously using a homemade iBeacon for presence detection as part of a larger home automation project, and I typically have bluetooth on all the time (for the car, and for my Pebble). The iBeacon on my Raspberry Pi wasn’t really working reliably, so I’ve scrapped that idea for now. It did reach pretty far (from the living room out to the end of the driveway), and I conveniently have a closet with a power outlet beside the door, so I can hide some electronics in there if needed and get better range.
I might come back to this idea eventually with an Estimote or similar by the front door, using the Launch Here iOS App to bring up Lockitron using a URI. Launch Centre Pro also now supports iBeacon ranging, and Geofence support for actions. This still requires swiping in the Lockitron app to unlock/lock the door.

GPS Geofencing - IFTTT

Works across all devices that I have the IFTTT app set up on, and locks/unlocks the door automatically without swiping in the Lockitron app. It’s a bit slow to respond to region entry (typically 30s-1m, as long as 3m has been seen). Since it is strictly region based, it doesn’t handle time and date changes (I might come home from work at 6pm one day, or 10pm the next). This idea might make more sense if Lockitron is able to stay on Wi-Fi all the time, either through a power retrofit or similar.

GPS Geofencing - OwnTracks

Since then, I’ve experimented with running an MQTT Server, OpenHAB, and OwnTracks to do location based/geofence presence detection. OwnTracks is essentially an open source version of Google Latitude. Now I have my RPi HA server know if I’m at home, or work, and it’s been pretty reliable so far. So I have a way of communicating how far away I am from home, and my phone does it automatically. I could set a region here since it is very quick to respond (typically 2 seconds), as opposed to the slower response I’m seeing for IFTTT to detect my location.

Combination of OwnTracks, Calendar, Script

So I’ve decided to come up with a combination approach. In the IFTTT Integration thread, it’s mentioned that in the first version of the sleep control will not be scheduled. An API call would have to be made when we want Lockitron to be awake more frequently vs. sleeping, and there will be guidelines on how often to do this without draining the batteries. My idea here is to have a script in OpenHAB on my RaspberryPi “read” my work schedule set up on iCloud, and check my expected work end time. When that time hits (let’s say 5PM), it will start to check what my last reported location is, and estimate how long it would take me to arrive home with current traffic conditions. When I finally get approximately 10 minutes away from home, the script will start to call the Lockitron to have it awake and ready for me to approach. Once I finally arrive home and enter the geofence at the bottom of my driveway, OpenHAB flips a presence detection switch to “on”, and then sends the command to unlock the door. At that point, I walk up to the door and enter the house with no issue. I haven’t implemented this yet, but the scripting on my side is underway, just waiting for the sleep control to become a part of the V2 API.

If you made it to the end here, congratulations! These are just my ideas for getting Lockitron to unlock/lock without having Sense available just yet, and they do involve a lot of work. Eventually Sense will be an option, and we’ll just walk up to the door and have Lockitron respond. Until then, I’ll keep working on these ideas and try to figure out a workaround.

Android bluetooth 4.0, sense
Multiple Bolts?
Delayed commands and text errors - power saving disabled
Is sense working for others nicely?

@anthonylavado awesome ideas! I see why you were asking about the URI re Launch Here. Not to worry, however, as we are working on Sense! I would be curious to here how consistently your Geofences trigger.

Building out Lockitron’s scheduling for wake/sleep periods is exciting for us since ideally a dynamic schedule should make Lockitron both more responsive as well as consume less battery power. While this eventually will be one of Lockitron’s autonomic functions, it’s a bit lower on our list of priorities. If your schedule isn’t too dynamic it might be possible create an IFTTT trigger to set wake/sleep times (i.e. at 5pm every day wake Lockitron).

Easiest way to unlock?

Thx for sharing… I setup IFTTT geofencing with Lockitron to get a hacked version of ‘Sense’. I’ll let you guys know how it works after I’ve tested it for a couple days.


Thanks for trying that @jocamero. I have been testing this quite a bit but have not documented my experiences yet. I will say that on the iOS side, IFTTT is generally “okay” at grabbing my location. Walking seems to pose more confusing results (ie false readings of being in my home zone) than driving does. I’ve made a few refinements that I haven’t posted about yet.

For yourself, the “hacked” version of Sense with IFTTT and a real Lockitron would go like this:

If this-
you enter a zone (iOS Location Channel/Android Location Channel)
set geofence to end of driveway/front door area (as close as possible and as small as possible to prevent false activation)

Then that-
Open a lock (Lockitron Preview channel)

Then all you have to do is knock on your door, it should wake up, get the command, and unlock for you. Don’t even have to take your phone out of your pocket.
Hope this helps!


Well, it works, just very slow. It seems the amount of time it takes Lockitron to ‘check in’ via WiFi can take almost 30 min and is the limiting factor. I see in the IFTTT activity log when I exited the geofence, IFTTT sent the notification via the Lockitron API, then a new entry in the iOS app’s Activity section appears stating ‘Lock Offline’. It wasn’t until 23 minutes later that the command was actually executed and the door locked. Upon my return into the gofence, IFTTT sent an unlock command, app again had a new entry for ‘Lock Offline’ and I waited about 10 minutes before giving up and knocking on the door to wake up Lockitron. About 15 seconds later it woke up and executed the command. If I could increase frequency of Lockitron’s checkins via WiFi it would make this workaround useful.

tl;dr if you have Bluetooth LE on your phone use that for the time being.


I tired the iBeacon (and something similar called a tod beacon) to trigger beaulebens Pebblock running on my mac mini but I too found both the iBeacon and tod to be unreliable. I though about some kind of deamon service running on the Raspberry Pi to constantly check to see if my iPhone was connected to my home WiFi using the arp command and unlock the door if my phone just connected or lock if my phone just disconnected but I dropped the project in favor of building a full fledged iPhone app (still in progress) so that more people could use the feature without having to enter their MAC address or set their phone for a static IP address.

For the most part I’m having a lot of success with geo-fencing using IFTTT. I got around the 30s to 3m delay that you mentioned by increasing the size of my geo-frence so that it triggers the lock/unlock sooner. I have an intercom system at the entrance of my apartment building that I trigger using Twilio SMS sent to a Beagle Bone inside my apartment intercom connected to a relay so I’m not as concerned about my inside apartment door taking a few minutes longer to lock after I leave or unlock before I come home.

I haven’t explored any of the open source options you mentioned but will have to look into it if the response time really is only a few seconds (as compared to IFTTT).

As for calendar script I have my work schedule set up on iCloud on my Mac and tried having it trigger a script to run the Pebblock webpage on my Mac Mini which worked but but locks my door too soon if I leave later than my calendar event.

I also set up a IFTTT trigger within Launch Center Pro that locks/unlocks my door on command (I still have to knock to wake up the Lockitron if I’m in front of it) which I find is reliable and faster than opening up the official Lockitron app.

Overall however, the best solution has been the PebbleLock Pebble app I just built and published today in the Pebble app store (well it’s been submitted but isn’t available to install for iOS users till Pebble updates their Pebble app with my javascript code). It let’s me quickly lock/unlock my door using my just my Pebble (and a knock on the door to wake up the Lockitron).

Now that the Pebble app is built I’m working on an iOS Lockitron app with an extension that will allow you to send quick lock/unlock commands from the notification center and lock screen (let me know if your interested in testing).

It’s very cool that your looking into all this. I thought I was the only one crazy enough to jerry-rig some complicated system to make the overall process of locking/unlocking my door more seamless.


@Hanlon @jocamero would setting the sleep timeout help with either of these? We’re working on getting that into the public API so you can wake Lockitron as soon as you enter a wider geofence and keep it awake until the iBeacon encounter.


I would think so. If anything I could potentially leverage my Nest’s motion sensor to tell Lockitron I’m home and to save power, and perhaps once Nest know’s I’m away, notify Lockitron to checkin more often while I’m away? Nest announced an updated API yesterday ‘Works with Nest’ to make this a bit easier.

How often does Lockitron checkin now and how long do the batteries last? I think replacing (or recharging?) the batteries every 3 months is reasonable (maybe monthly with rechargables?), any longer than that I’m willing to sacrifice battery life for a more responsive Lockitron.


@cameron an increased sleep timeout (or increased check in frequency with a shorter sleep timeout) would definitely help for the geo-fencing. It would allow me to set a smaller geo-fence radius and be less worried about the length of time my door is locked/unlocked after I leave or before I get home.

But leaving this choice up to the end user could confuse people (so an API call is a good choice). As Maxime Veron, the Director of Product Marketing at Nest Labs, said to Christopher Mims in an interview with TWSJ, […he emphasized that the company’s thermostat is deliberately not programmable…] to simplify the experience for the end user. Maybe put it as a call in the API but have it learn and adapt to meet the needs of end users who aren’t savoy enough to write their own app but still want to use geo-fencing within IFTTT (and would need a longer sleep timeout).


@Hanlon agreed; our belief is that custom API clients should be given as much access as possible (and is reasonable given we don’t yet limit access by scopes) although we don’t explicitly plan on exposing these types of settings through our own clients to users.


Does anyone know if you can set lockitron to lock 1 minute after you unlock it? If not is it possible though IFTTT?


@joel_d_eggenhui I haven’t seen anything in IFTTT to this effect (it’s more based around locking/unlock under other circumstances, rather than time), but you could do this with the API and Webhooks I’d imagine. Get something that’s notified when the lock is unlocked (Webhook), then pause 1min, send lock command (API post req).


thanks Anthony. much appreciated


@joel_d_eggenhui @anthonylavado new API endpoints will help with this since you will be able to set the “wake period” yourself. Will keep you posted once these are available and documented.