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, Push.co, 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.