Temporary intercom hack

The cylinder of our front door had to be replaced, and this took a few days. When housemates left, they either had to leave the door open, or pray that someone else was home when they got back. After the first day of annoying doorbelringing I hacked together a way for people to open the door with their phones.

First I thought of messing with the intercom's electronics, but this had a big chance of breaking it. Then I remembered I had a Lego Mindstorm lying around. These things are awesome; with a few lines of Python code you can have it make a motor twist. This was perfect for the task. Instead of messing with the existing infrastructure, I could make a pluggable extension that could also be easily removed when the lock was to be fixed.

The setup was simple: Connect Mindstorm to Wifi, have it run a little webserver, trigger motor when web page is triggered to press intercom. With a few hours of hacking it together I had this neat prototype. Here is a video of it working.

So then, testing happened. I went to the door, stood on the inside, pressed the button via my phone (via the local Wifi), and presto, the thing pressed the intercom. It worked. I knocked on my neighbors door.
"Come check this out," I said. "I can open the door with my phone."
We went outside, where it was raining, and I shut the door. "Here we go!" I pressed the button: nothing happened.

As it turned out, the Wifi signal that was required to trigger the intercom 'press thing', was just out of reach when standing outside of the door. A nasty design flaw to discover during a demo, which turned the whole 'Cool door hacking demo' into a more 'Thanks for dragging me out into the rain' type of situation. We had to ask a neighbor to open the door for us.

After the initial hickups I made a better version. And version two turned out great. Its workings are simple: The web service (Flask) is reachable online, running on a VPS. This service shows the button. When the button is pressed, a file is created on the server. The Mindstorm checks every minute if the file exists (cronjob), and if so, it opens the door. The web server deletes the file once it's requested. I also made a little killswitch to shut down the Mindstorm remotely.

The last version worked neatly and was used by almost all housemates until the lock was fixed and we could use the keys again. My security instinct had me take the thing down, because I didn't like the idea of strangers being able to open the door if they knew the correct URL. But for the time it lasted, it sure was better than just leaving the door open.