Log in

No account? Create an account
Android Garage Door Opener, part 2 - brad's life — LiveJournal [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.

Page 1 of 2
<<[1] [2] >>
From: evan
2008-10-26 07:23 pm (UTC)

ours isn't nearly as fancy

Yesterday when I walked home there was some kids sitting on my stoop. I stopped in front of them and fumbled with my bag to pull out my phone and they gave me a quizzical look. Then I hit the button to open my front door and they gave me an even more quizzical look as the door buzzer buzzed.
(Reply) (Thread)
[User Picture]From: mart
2008-10-26 08:03 pm (UTC)

Re: ours isn't nearly as fancy

I got a look much like that when I was staying at Brad's. I left the house in the morning through the garage and crossed over to the other side of the street where reception is better for some reason, then looked back at the house and fumbled with my phone a bit to close the door. A guy who was waiting by a car on the sidewalk looked like he was about to ask about it but then he got into his car and drove away.

The weird thing is that it seems that phone-controlled doors aren't that unusual. The apartment block I'm in right now has a phone-accessible door control that I can in theory call and press 9 to open the door, though they use caller-id as the access control and I've not told them my number so I've not tried it out. I think the intended way to use it is for the door to call you and you to let other people in, but according to the instructions it works both ways.

(Reply) (Parent) (Thread) (Expand)
[User Picture]From: ciphergoth
2008-10-26 07:46 pm (UTC)
Does stopping the bike, getting your phone out, finding the activity, pressing the button, putting your phone away, starting up the bike again and putting it in the garage actually save you any time over driving to your home, dismounting in front of the door, opening the garage door and wheeling your bike in?

Of course, that's not entirely the point, but still...
(Reply) (Thread)
[User Picture]From: mart
2008-10-26 07:56 pm (UTC)

Presumably in practice this would be activated before Brad heads home from somewhere else, so the extra stop wouldn't be necessary. I assume he did it this way for the test just because home was both the source and the destination.

(Reply) (Parent) (Thread) (Expand)
Re: Purpose - (Anonymous) Expand
(no subject) - (Anonymous) Expand
What about more? - (Anonymous) Expand
From: (Anonymous)
2008-10-26 08:24 pm (UTC)

Posting source online?


Will you be posting the source online?
(Reply) (Thread)
[User Picture]From: brad
2008-10-26 08:30 pm (UTC)

Re: Posting source online?

If I do, it won't include the secret key for my garage door server. :)
(Reply) (Parent) (Thread)
[User Picture]From: muerte
2008-10-26 08:32 pm (UTC)
$geek_points += 100;
(Reply) (Thread)
From: ext_130285
2008-10-26 08:49 pm (UTC)

Battery life?

What does keeping the wifi manager open do to your overall battery life?
(Reply) (Thread)
[User Picture]From: brad
2008-10-26 08:52 pm (UTC)

Re: Battery life?

Don't know or really care: it's only for a few minutes, and once I'm home I'll just be charging it anyway. And since I only activate the scan once I'm heading home.... well, it all works out.

(Reply) (Parent) (Thread)
[User Picture]From: dan_lane
2008-10-26 09:12 pm (UTC)
Gah, every time you post about developing for Android I want one even more. Love the idea of Growl-like notifications!

T-Mobile UK are taking their sweet time getting me a G1 review unit :(
(Reply) (Thread)
[User Picture]From: jtrevino
2008-10-26 09:34 pm (UTC)


That's freak'n sweet, dude!
(Reply) (Thread)
[User Picture]From: aca
2008-10-26 09:55 pm (UTC)
Dude, you are such an epic geek. I fucking love this. :)
(Reply) (Thread)
[User Picture]From: matthew
2008-10-26 10:17 pm (UTC)
Personally I just put a garage door opener in the sleeve pocket of my riding suit. Of course, that won't stop me from using your system :D

So most importantly, how is your garage door opener wired into a web server?

Edited at 2008-10-26 10:18 pm (UTC)
(Reply) (Thread)
[User Picture]From: brad
2008-10-26 10:37 pm (UTC)
Custom webserver (little Perl script hanging off xinetd), heyu, and an X10 relay.
(Reply) (Parent) (Thread)
[User Picture]From: jojobear99
2008-10-27 05:19 am (UTC)
sounds pretty cool :)
(Reply) (Thread)
From: bennry73
2008-10-31 05:50 pm (UTC)


(new here) I like this application a lot! I've been working on an Android app and some of my questions and concerns have clearly been overcome by your project. I was wondering if you could shed some light on some issues I'm having with development.
(Reply) (Thread)
[User Picture]From: brad
2008-10-31 10:05 pm (UTC)

Re: WifiManager

I don't know. Maybe. Depends what your issues are.
(Reply) (Parent) (Thread) (Expand)
Re: WifiManager - (Anonymous) Expand
From: ext_131440
2008-11-01 10:18 pm (UTC)

garage door opener's what??

"my garage door opener's webserver"
ok that part made me laugh!
(Reply) (Thread)
From: (Anonymous)
2008-11-17 04:59 pm (UTC)

As a fellow motorbiker I exalt thee

When sun came up with the sunspot, i immediately thought "garage door opener"! haha love what you have done with the dream phone seriously, its a pretty damn awesome implementation of the radio wifi. Question is, "what kinda garage door opener had a webserver"?

(Reply) (Thread)
[User Picture]From: brad
2008-11-17 06:55 pm (UTC)

Re: As a fellow motorbiker I exalt thee

X10 Universal Module + custom webserver I also wrote.
(Reply) (Parent) (Thread) (Expand)
From: (Anonymous)
2008-11-19 03:21 am (UTC)
id be interested in the source to that garage door opener as well
(Reply) (Thread)
From: simplyg1
2008-11-20 03:33 pm (UTC)

garage activity

Oh man this is sweet! Brad: You think you may sell this applictaion? If you do let me know. Our site is about to have a store on it and any apps you have you wanna sell, let me know. i will make sure you are taking care of.
(Reply) (Thread)
Page 1 of 2
<<[1] [2] >>