Log in

No account? Create an account
Android Garage Door Opener, part 2 - brad's life [entries|archive|friends|userinfo]
Brad Fitzpatrick

[ website | bradfitz.com ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Android Garage Door Opener, part 2 [Oct. 26th, 2008|12:06 pm]
Brad Fitzpatrick
[Tags|, , , ]

This is a follow-up to my previous post to say:


I got it all working. I now have an Android Activity (GarageDoorActivity) which interacts with an Android Service I wrote (InRangeService), letting me start and stop the service's wifi scanning task. The service gets the system WifiManager, holds a WifiLock to keep the radio active, and then does a Wifi scan every couple seconds, looking for my house.

When my house is in range, it does the magic HTTP request to my garage door opener's webserver (HMAC-signed timestamped URL, for non-replayability/forgeability if sniffed) and my garage door opens. Complete with a bunch of fun Toast notifications (like Growl) and Android Notifications (both persistent ongoing notifications for background scanning, and one-time notifications for things like the garage door actually opening).

I just threw on some shoes and hopped on my motorcycle to do a test lap around the neighborhood. When I got to the corner, I pulled up the activity and press "Start" (aka "Going home now"). A lady on the corner saw me playing with my phone on my motorcycle and said, "The reception's not so good up here." I thanked her, not wanting to explain what I was actually doing.

I then finished the lap around the block and the garage door started opening a few houses away. By the time I pulled up, I could already back the bike into the garage. HELL YES.

Update 2008-11-16: The source code is now available.

From: (Anonymous)
2008-10-28 12:38 am (UTC)

What about more?

You could add another layer of geekiness just to make sure: (assuming you could have automatic pick-up when it's from your server and that you have an earpiece)
when you approach your house, your webserver gives you a call to ask confirmation with a nice sexy voice, a little bit of voice recognition for "yes", "no" and/or a password and you're good to go, no?

Maybe too far :)

But good job otherwise! I really love the multiple steps involved in doing it.

Question though: couldn't you do it only on the server's side by catching when your phone's MAC address is connecting to your WAP? I know it's missing the point of the Android app, but for people who don't have an Android phone, I suppose that could be another way of doing something similar.
(Reply) (Parent) (Thread)