Writing

Feed Software, technology, sysadmin war stories, and more.

Monday, July 4, 2011

A doorbell I could hear from hundreds of miles away

I used to have a suboptimal arrangement involving package deliveries going to a door which was not my usual entry point. Something might arrive while I was gone, so I'd have to go check for delivery by polling. For various reasons, not all of them could be tracked online. Polling bothered me. I wanted to be notified instead, and came up with a hack.

This one required a whole bunch of little pieces. First, I had to tap into my doorbell with a pair of wires so I could get the same signal it was seeing from the outside button. My assumption is that someone would ring it every time they left a package, and that was good enough to get started. These wires went back to an X-10 transmitter called the "burglar alarm interface" module. It would just send an ON signal when triggered.

Alpha pager with doorbell message

Elsewhere, I had to do something with that signal. There was another little X-10 box called the cm11a which served as a transceiver for those power line pulses. It was typically used to flip lights on and off, but with a bit of coding I was able to make it listen to the line and report on state changes. I had it look for the ON signal coming from that other module.

I had written a small daemon which would listen to a serial port and handle incoming traffic from my cm11a. It was configured to handle that ON signal by running a small shell script. That shell script was then responsible for creating an e-mail and directing it at my pager's e-mail address. sendmail took it from there and handed it to my pager company's mail exchanger.

They did whatever magic they needed to put it on the air, and a few moments later I'd get my doorbell notice wherever I happened to be. Then, upon arriving home, I could poll just once and get my packages. Bliss!