Préalable
-
Il faut s'assurer que le pilote de la caméra soit bien installé. Si la webcam utilisé est la pi camera V2 ( noir ou non), il va falloir activer un pilote présent sur raspbian Jessie mais non actif:
echo "bcm2835-v4l2" | sudo tee -a /etc/modules
- Verifier aussi que ces paquets sont bien installés
sudo aptitude install python-tornado python-jinja2 python-imaging motion ffmpeg v4l-utils
- Il faut enfin que le module camera soit bien activé dans raspi-config
Installer les dépendances:
wget https://github.com/ccrisan/motioneye/wiki/precompiled/ffmpeg_3.1.1-1_armhf.deb
sudo dpkg -i ffmpeg_3.1.1-1_armhf.deb
sudo apt-get remove libavcodec-extra-56 libavformat56 libavresample2 libavutil54
sudo apt-get install python-pip python-dev curl libssl-dev libcurl4-openssl-dev libjpeg-dev libx264-142 libavcodec56 libavformat56 libmysqlclient18 libswscale3 libpq5
sudo apt-get -f install
Installer Motion
sudo wget https://github.com/Motion-Project/motion/releases/download/release-4.0.1/pi_jessie_motion_4.0.1-1_armhf.deb
sudo dpkg -i pi_jessie_motion_4.0.1-1_armhf.deb
Installer MotionEye
sudo apt-get install python-pycurl
sudo pip install motioneye
Préparer le dossier de configuration
sudo mkdir -p /etc/motioneye
sudo cp /usr/local/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf
#
sudo mkdir -p /var/lib/motioneye
sudo cp /usr/local/share/motioneye/extra/motioneye.systemd-unit-local /etc/systemd/system/motioneye.service
Lancer le service
sudo systemctl daemon-reload
sudo systemctl enable motioneye
sudo systemctl start motioneye
Acceder à MotionEye en local depuis le navigateur
Connaissant l’adresse Ip de votre Raspberry, dans la barre d’adresse entrez simplement : http://192.168.0.10:8765
Lancer un script python depuis à MotionEye "Run a command"
Il faut créer un script executable qui sera appelé par MotionEye.
1) Créer un script python : nano monScript.py
2) Exemple de script, enregistrement de l’heure et la date des détections :
import time
f = open("/home/pi/motionDetection.log","a")
f.write(time.strftime("%Y-%m-%d %H:%M")+'\n')
f.close()
3)Rendre le script executable :sudo chmod +x monScript.py
4) Dans la case “Run a command”, insérer uniquement l’adresse du script : /home/pi/monScript.py
Source :
https://github.com/ccrisan/motioneyeos/wiki/Installation
http://www.howtoembed.com/projects/raspberry-pi/95-motioneye-with-raspberry-pi