3

I am trying to set up a Raspberry Pi model B+ with PiCamera to be a security camera. Wifi connects to my home network, motion is installed, detecting motion and saving pictures, and I am able to send mail via ssmtp and Google's servers at smtp.google.com:587. You can see my setup here.

The problem is with the on_event_start and on_picture_save triggers, which do not seem to fire. on_event_start executes the command: mail -s "Motion detected" MYEMAILADDRESS </dev/null; that command works fine when I run it by hand, but is not run when motion is detected. on_picture_save executes the command: mpack -s "Patio door" %f MYACCOUNT@sendtodropbox.com; that command works fine when I run it by hand, but is not run when a picture is saved. I know the setup is right because I have a working "Front door" security camera that I set up six months ago and it is still working properly.

Can anyone suggest what I might have missed when setting up the new camera?

clemtoy
  • 185
  • 2
  • 3
  • 8
user448810
  • 173
  • 2
  • 10
  • What does the command mail -s "Motion detected" MYEMAILADDRESS actually DO on your system, if you just put it in as a command line? (I'm assuming you have changed MYEMAILADDRESS to something sensible). – Mark Williams Jun 17 '15 at 14:50
  • It sends me an email with an empty body. I forgot the redirection of </dev/null that creates the bulk body. – user448810 Jun 17 '15 at 16:15
  • I have a similar problem. In my case, on_picture_save works but on_event_start doesn't... – clemtoy Sep 23 '15 at 13:25
  • @SteveRobillard Well it seems it's a bug as you can see in this – clemtoy Sep 23 '15 at 16:04
  • @clemtoy thanks for the quick response. I am going to leave the edit since user448810 is OK with it. I am also going to clean up the comment thread. – Steve Robillard Sep 23 '15 at 16:13
  • Have you tried another action, like writing to a log file (or just use logger), to make sure that the events are actually being triggered ? It could also be a permission problem, if motion is running as another user or doesn't have sufficient rights to the pictures directory. – Kate Mar 07 '17 at 23:17

1 Answers1

0

I would test this by putting a simpler command in place of the mail & mpack commands - why not change the line to this:

on_event_start : >~/Trigger1 # this just creates an empty file   
on_picture_save : >~/Trigger2  

and see if these 2 files are generated when an event fires off?

Then you can test the actual real commands, by typing them into terminal, and see if a file does actually get sent; then copy the working line into the config file.

Jacobm001
  • 11,898
  • 7
  • 46
  • 56
Mark Williams
  • 317
  • 3
  • 7
  • I've already tested the actual real commands. They work fine from the command line. I suspect some permission issue that prevents motion from running the command. – user448810 Jun 17 '15 at 16:18