Skip to content

How to Run Your Own Script after Motion Tracking Activated

Claude Pageau edited this page Oct 21, 2018 · 1 revision

Introduction

A template python script file called user_motion_code.py can be found in the pi-timolo folder. Code in this file is imported by pi-timolo.py and will be executed when motion tracking is triggered but after motion image or video is taken. Note Motion tracking option must be activated per config.py variable motionTrackOn = True

Details

If the file cannot be found then run an upgrade from the menubox.sh script. The file will be downloaded with the latest curl pi-timolo-install.sh install. if user_motion_code.py does not exist it will be downloaded. An existing file will not be overwritten to avoid losing user customization.

You may add python code to the user_motion_code.py file. If specialized python libraries need to be loaded for your user motion routine, you can add them to the top of the user_motion_code.py file and then call them in the userMotionCode() function. The userMotionCode function is passed the filename path variable of the image or video file so it can be used for example in your code if desired. This can be useful if you need to add an attachment or process the motion track media file. You can also add other functions to user_motion_code.py as long as they are called directly or indirectly somewhere inside the userMotionCode function since that is the only function that is called within pi-timolo.py script if motion is detected.

Clone this wiki locally