The core part of the project is actually ready. If all is configured correctly, the presence of an intruder will be detected automatically, and the recorded videos will be saved on the local drive (SD card). However, we may not get the access to our board in order to retrieve the files or simply, we'd like to know sooner. In order to transfer the files, I use Part II from this tutorial as it provides an easy way for future expansion and excellant explanation, except for scheduling the activity of Motion using
The general idea of this approach is to "emulate" a mail box using the Raspberry and send an email to oneself using the attachment (recorded videos of the intruder). I will recall the instruction for the sake of completion, but it essentially comes from the link I stated above.
As you remember, the
on_event_end line inside
motion.conf file provides the "entry point" here (or exit rather... nevermind). By typping
sudo zip_and_mail.sh there, we are going to execute the script, which will collect all the content of the
INBOX directory, compress it and send it to us by email.
In my implementation, I have modified the script slightly in order to fit with my needs better. I do not use the
stopmotion.sh scripts as instructed. Instead, I only use the
Following the link, I assume that you have installed the
mutt packages as well as configured them just as stated therein.
Now, our task is to complete the code of
Important! Gmail is constantly improving the security, so in order to actually make it work using Gmail, make sure that you lower the security level for the email account. Personally, I advice you to create a separate and dedicated account for this job.
The content of the
zip_and_send.sh script in my implementation is the following:
Here, remember to create the
OUTBOX directories before executing this script. The
zip_and_send.sh must also be executable (permissions!). If everything is done correctly, warning emails should start appearing in your mailbox as soon as some movement is detected.