My Doorbell has an IP Address
Posted 15 November 2016
My doorbell has an IP address. I know it's been done before, but I did it because:
- I can ;-)
- I have a hard time hearing the doorbell in the garden
- Almost all the tech I needed is easily available
I've hooked up our original-to-the-house, brass and bakerlite doorbell button to a Yahoo yodel button. I've also added a Raspberry Pi (it's an old model 1), some GPIO connectivity 'glue', some Python and a Mosquitto server.
The Pi 'watches' the doorbell button via a connection to the GPIO port. I put a small resistor and an Schottkey diode on the GPIO connection because the Pi is quite sensitive to any out-of-spec voltages on its GPIO pins. The PI GPIO is a 3.3V system, whereas the yodel is more like a 4.5V device. The yodel makes a sound if it's button pulls a particular pin low, so a bit of Python watches for a falling edge on a GPIO pin. The Python GPIO libraries call a callback when the falling edge is detected, and does some switch de-bounce too. The callback just sends an Mosquitto (MQTT) message.
MQTT has a variety of 'QOS' options on messages. I'm using 'try to send, otherwise don't bother' mode. That means that if you're not listening to the server when the doorbell is pressed then you'll miss the message. I guess a variety of listeners can attach to the server and do other things if the message is received (one thought, for example was to send a text message).
The major piece of the puzzle that's still missing is something to properly act on these messages. I thought I could use an Android app to make a sound on my phone, but it seems suitable apps are hard to find. I have a couple of 'debugging' type apps so I can see the messages coming in, but they don't really do proper notifications.
One other thing left to do is to tie down the Mosquitto server a bit. Ideally I'd setup the doorbell topic to only accept publishing from the localhost. That would stop anything on the network from prompting my phone to ring just because they say so. I also wonder if the publisher needs to cryptographically sign its messages so clients can be sure they're real. This might be over-kill as it's all ring-fenced inside our home network, but it's probably good practice and is a bit more future-proofed.
All in all, it's been both easier and harder to get this far. If I can solve the Android app 'problem' then I'll have a properly working solution. Some other tidy-ups will make things a bit more solid.
More blog posts:Previous Post: Ansible Connected CheckMK | Next Post: Ubiquiti Wireless APs