Setup Motion on Raspberry Pi with Email Motion Alert

As postfix config use „Direct SMTP“ option, if necessary enable TLS:

You can test if everything works correctly with:

Now its time to get a version of motion tailored for the raspicam:

Add the freshly created motion user and yourself to the video group just for good measure:

Otherwise the motion service may fail silently with * failed to open vchiq instance

Enable and start the motion daemon with

Create a directory for motion’s videos and log files:

Make some adjustments to motion.conf, especially the paths for logs and videos:

and change
;on_picture_save
to
on_picture_save echo ‚Motion alert‘ | mail -a %f -s „Motion alert“

and reload the config file:

Create a directory for motion’s videos and log files:

Check if the motion process is running by

motion 7676 82.4 2.6 91488 23656 ? Sl 13:00 1:33 /usr/bin/motion

If there is no running motion process, check the service status for additional details why motion exited:

The output should look like:

tatsch@raspberrypi3
● motion.service - LSB: Start Motion detection
Loaded: loaded (/etc/init.d/motion)
Active: active (running) since Sat 2016-06-11 13:00:30 CEST; 1s ago
Process: 7662 ExecStop=/etc/init.d/motion stop (code=exited, status=0/SUCCESS)
Process: 7669 ExecStart=/etc/init.d/motion start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/motion.service
└─7676 /usr/bin/motion

Jun 11 13:00:30 raspberrypi3 motion[7669]: Starting motion detection daemon: motion.
Jun 11 13:00:30 raspberrypi3 systemd[1]: Started LSB: Start Motion detection.
Jun 11 13:00:30 raspberrypi3 motion[7676]: [0] [NTC] [ALL] conf_load: Processing thread 0 - config file /etc/motion.conf
Jun 11 13:00:30 raspberrypi3 motion[7676]: [0] [NTC] [ALL] motion_startup: Motion mmaltest Started
Jun 11 13:00:30 raspberrypi3 motion[7676]: [0] [NTC] [ALL] motion_startup: Logging to file (/home/tatsch/motion/motion.log)

If motion is setup correctly, you should be able to see the web stream:

http://raspberrypi3:8081

If you are unable to open the stream, check if motion is listening on the port:

Schreibe einen Kommentar