Engineer Christian Hollinger has published a project write-up in which a Raspberry Pi single-board computer is given the task of monitoring guinea pigs — through a Telegram chat bot.
“We were planning to take a short vacation, and while not at home, there are still things that would be nice to observe from afar, namely our two guinea pigs, Porkchop and Hamhock,” Hollinger explains. “Now, naturally, this is a problem that has been solved time and time again, usually by way of cheap IoT cameras (you can find them on Amazon for $30-$40) that somehow, magically, allow you to see what’s going on via an app.”
“While that is undoubtedly convenient, it also requires a lot of trust in a (most likely) unknown camera brand to not only store your data, but also essentially giving them access to your home network (you installed a physical device on your own Wi-Fi, remember?).”
This Telegram-based remote monitoring system keeps the home network firewalled off from the ‘net. (📷: Christian Hollinger)
Hollinger decided he needed a home-brew camera system built around a Raspberry Pi, but one which doesn’t require any ports to be forwarded from the internet to the internal network — and which doesn’t require the use of a virtual private network (VPN) or other tunnel in. The solution: Telegram bots.
“In order to get to the footage from the outside, I came up with a middle ground between ‘trust a random vendor,’ ‘trust a known brand,’ or ‘tunnel into your home network’ — by using a Telegram bot,” Hollinger notes. “Telegram, a cross-platform messenger with optional end-to-end encryption, provides a fairly rich Bot API, which in turn has wrappers and SDKs in various languages.”
The camera accepts commands, and transmits images, via Telegram. (📷: Christian Hollinger)
Using a Raspberry Pi Zero W with camera, and the MotionEye OS, Hollinger was able to easily monitor his pets — while the Telegram bot which allows him to view snapshots on Telegram is installed as a Docker container using the Go-language API for Telegram. “I’ve used Go,” he explains, “because it compiles to small binaries, is fast, has great support for parallelism, is strongly typed, and is written quickly.”
The full project write-up, which includes allowing the camera system to respond to commands sent via Telegram, is available on Hollinger’s blog, while the source code has been published to GitHub under the reciprocal GNU General Public License 3.