This is the first of a series of posts describing some (hopefully) compelling ideas for DIY projects that you can carry out to make your home a little bit smarter.

I have tested these solutions myself throughout the years. Indeed, from time to time, I like to “hack” my house in order to add new features or to improve the existing ones. From this point of view, my place represents a sort of test field where I experiment with technologies and devices.

Warning! These projects don’t intend to be good examples of engineering too, as they can be improved and optimized largely. The main goal is to provide some ideas which can be implemented with a relatively small effort—I have so little free time—and which can represent starting points for more advanced and feature-rich projects.

The surveillance system

The first project I’ll talk about is the surveillance system I made in 2014. The following image shows its simplified block diagram.


The structure is quite simple. It consists of a Linux box running ZoneMinder video surveillance software (version 1.26.5) and four PoE cameras.

The computer is a headless PC. As it is unattended, I had to change its default power-up and bootstrap sequence in order to start the operating system automatically every time the machine is powered. At BIOS level, I enabled an option that avoids the need to press to power on/off button to start the PC. With regard to the bootstrap sequence, I had to change the GNU GRUB2 configuration. In particular, I had to add the following line to the file /etc/default/grub (for more details, see for example this page):


Unfortunately, the installation and the configuration of ZoneMinder were not straightforward. To make it work, I had to read patiently the official documentation and some tutorials. ZoneMinder is very flexible in terms of monitoring and there are numerous settings you can play with. Thus, it took me a while before completing the tuning process in order to make it work as expected. This process is a typical example of the “trial and error” approach. For example, when I started to play with monitors and zones, I misconfigured the system: inadvertently, I created a circular dependency between two cameras. The outcome was that when one of these cameras turned into the alarmed state, the other one got alarmed as well. This, in turn, alarmed the first camera again and so forth.

One of the features of ZoneMinder that I appreciate the most is the email alarm notification. Surprisingly, the version I installed didn’t provide an easy way to enable/disable this kind of notifications, in spite this operation is used frequently (in general, you need to disable it every time you come back home because, of course, you don’t want to receive tons of emails to warn you that you are walking in your garden). I found on the ZoneMinder forums another user facing the same issue. As I couldn’t find a ready-to-use solution, I modified the code of ZoneMinder. I made this change to the file:

--- /home/llandre/work/zm/home/llandre/
+++ /home/llandre/work/zm/usr/bin/
@@ -582,9 +582,19 @@
         if ( ZM_OPT_EMAIL && $filter->{AutoEmail} )
+	    my $email_flag_alarm_filename = '/var/cache/zoneminder/misc/email_alarm_disabled';
             if ( !$event->{Emailed} )
-                $delete_ok = undef if ( !sendEmail( $filter, $event ) );
+                if (-e $email_flag_alarm_filename )
+                {
+                    # We skip real email sending          
+                    $delete_ok = undef if ( !sendEmailFake( $filter, $event ) );;
+                }
+                else
+                {
+                    $delete_ok = undef if ( !sendEmail( $filter, $event ) );
+                }
         if ( ZM_OPT_MESSAGE && $filter->{AutoMessage} )
@@ -947,6 +957,20 @@
     return( $text );
+sub sendEmailFake
+    my $filter = shift;
+    my $event = shift;
+    Info ( "Skipping email sending for event '$event->{Id}'\n" );
+    my $sql = "update Events set Emailed = 1 where Id = ?";
+    my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() );
+    my $res = $sth->execute( $event->{Id} ) or Fatal( "Can't execute '$sql': ".$sth->errstr() );
+    return( 1 );
 sub sendEmail
     my $filter = shift;

This dirty hack is trivial: if the file /var/cache/zoneminder/misc/email_alarm_disabled exists in the file system of the Linux box, no email notifications are sent. That’s it. But how to create/delete this file easily even if you are not at home? I solved this problem by installing the VX ConnectBot app on my smartphone and by setting up a couple of scripts which log-in on the Linux box (over an encrypted connection) and create/remove the email_alarm_disabled file automatically. Thus, to enable/disable the notifications, you just need to tap a button on the smartphone’s screen.

Another convenient functionality I enabled is the real-time visualization of the images streamed by the cameras. To implement this, I used the RTSP Player app that I configured properly to receive such streams. Obviously, this is very useful when you receive an alarm notification after you left your house.

When I’m at home, I can access the surveillance system even if I don’t have the smartphone thanks to a cheap 8-inch Android-based tablet that I installed in the main fuse box of my house (I chose this place because it is easily accessible). The tablet is used as a sort of unconventional terminal to interact with the smart features of the home. With regard to the surveillance system, the tablet is equivalent to the smartphone as I installed the same apps I described previously. As a matter of fact, the configuration is a little bit different as the tablet is directly connected to my home’s network.

Last but not least, I had to deal with an issue related to the purging of the old files stored by ZoneMiner. Although this feature seemed to be configured properly, it didn’t work. I worked around this problem by creating a script that is run periodically by anacron:

llandre@hostname:~$ cat admin/
logger started

find /var/cache/zoneminder/events/2/ -mtime +30 -exec rm -rf {} \;
find /var/cache/zoneminder/events/3/ -mtime +30 -exec rm -rf {} \;
find /var/cache/zoneminder/events/4/ -mtime +30 -exec rm -rf {} \;
find /var/cache/zoneminder/events/5/ -mtime +30 -exec rm -rf {} \;

logger exiting ...

exit 0

Future work

One of the optimizations I would like to do in the future is to migrate from the PC to an embedded Linux platform. As the computational power required to run the surveillance software is not that high, a cheaper, smaller, more energy-efficient platform could replace the PC I have used so far.


    1. At the beginning of 2017, although I was not thinking about a series of DIY-related articles, I wrote three posts that belong definitively here:
    2. Featured image source: