Hello
with the same camera i made a custom configuration to be able to send a mail with a snapshot after a PIR motion detection :
pre requisits :
-mailutils + ssmtp :
http://www.raspberry-projects.com/pi/so ... end-emails
-domticz
-PIR
I made a directory snap : /home/pi/snap
snaping.sh : to generate the snapshot image located in snap folder
Code: Select all
#!/bin/sh
#generate the dynamic snapshot path
curl http://ipcamera:port/cgi-bin/hi3510/param.cgi?cmd=snap -o /home/pi/snap/locate.txt
#change the file to be ok for Curl -K
sed -i 's/ var path=\"/url=\"http\:\/\/ipcamera:port/g' /home/pi/snap/locate.txt/locate.txt
#generate the dynamic snapshot image
curl -K /home/pi/snap/locate.txt -o /home/pi/snap/snapshot.jpg
exit 1
chmod 777 for snapsing.sh
Then
Lua device script : PIR_Notification send a mail if motion is detected
Code: Select all
commandArray = {}
if (otherdevices['PIR'] == 'Motion') then
os.execute('sudo /home/pi/snap/snaping.sh')
os.execute('sudo /usr/bin/mailx -s Snapshot -A /home/pi/snap/snapshot.jpg [email protected]')
end
return commandArray
Et voila !