[Raspberry Pi] motionEye の動体検知時に Python ファイルを実行する

Raspberry Pi の motionEye で動体検知時にコマンドを実行する方法がよく分からないでいた。

動体検知時にコマンドを実行するには、motionEye の設定画面で「Motion Notifications > Run A Command」をオンにし、その下の Command にコマンドを入力する。

curl コマンドなどは実行できた。

しかし、Python ファイルなどが実行できない。

いろいろ試した結果分かったのが、Python ファイルを絶対パスで指定する必要があった。

すなわち、Documents フォルダに置いた command.py を実行するには以下のようにする。

python /home/pi/Documents/command.py

参考:
‘run a command’ on motion detection · Issue #74 · ccrisan/motioneye
https://github.com/ccrisan/motioneye/issues/74