0

I'm currently working on setting up a Raspberry Pi as a security camera to detect motion and email me a snippet of a .mkv if it detects movement. The bit in my motion.conf that handles this is:

on_movie_end motionmail %f

(motionmail is a script that I wrote to email me with the video clip attached. Nothing fancy.)

It all seems to be working fine, but there are quite a few false positives. Turning on locate_motion_mode, I've found the culprit is a window to the outside world (doh), so I tried area_detect. The problem is that this only seems to work with on_area_detect, which doesn't have the %f variable so it can't trigger a script to attach a video file. I think it also triggers the instant it detects motion, so the video won't have finished recording yet.

Is there a way I can combine the two? The best I can think of is to

  1. have on_area_detect trigger a script to cat "1" > some/file.txt, wait say ten seconds, then cat "0" > some/file.txt.

  2. edit motionmail to read some/file.txt and only send the mail if it reads a "1"

The only problem is that this kind of makes me want to throw up. Is there a more "elegant" solution? Or even a built in one? I'm thinking there may be a way to force a movie_start event using on_area_detect then use on_movie_end as normal, something like

on_area_detect trigger_movie_start
on_movie_end motionmail %f

but I don't know how!

Thanks in advance for any advice!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.