motion detection time option

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
Post Reply
jsbsmd
Posts: 10
Joined: Mon Aug 08, 2011 10:13 pm

motion detection time option

Post by jsbsmd »

I have a need to be able to set times I wish to record alarms from 8pm until 6am daily. during the other times, I do not want ZM you save any events even if motion is detected.
blastter
Posts: 5
Joined: Thu Mar 07, 2013 4:10 pm

Re: motion detection time option

Post by blastter »

You can add to the table, two hour comuns, the start and the end hour, and then you can add in the query in line 878 in the src/zm_zone.cpp the filter to enable only between the start and end event hours. I haven't tested it yet but I think it'll work, the only problem is that you need to modify the query and the interface.
Knolidge needed:
SQL->MySQL
Table to modify -> Zones
in database zm
You can find the database configuration in the zm.conf file in /etc/zm/ folder.
Good Luck. :wink:
tcpdump
Posts: 7
Joined: Wed Sep 04, 2013 12:39 am

Re: motion detection time option

Post by tcpdump »

It can be done without modifying zoneminder but it's not as clean.

in crontab:

Code: Select all

0 7 * * * /usr/local/bin/zm-v4 active
0 18 * * * /usr/local/bin/zm-v4 inactive
my zm-v4 script

Code: Select all

#!/bin/bash

case $1 in
 active)
mysql -s -N -uroot -p*password zm -e "update Zones set Type='Active' where Id=36"
mysql -s -N -uroot -p*password zm -e "update Zones set Type='Active' where Id=37"
sleep 1
kill `ps ax|grep "zma -m 9"|grep -v grep|awk '{print $1}'`
    ;;
 inactive)
mysql -s -N -uroot -p*password zm -e "update Zones set Type='Inactive' where Id=36"
mysql -s -N -uroot -p*password zm -e "update Zones set Type='Inactive' where Id=37"
sleep 1
kill `ps ax|grep "zma -m 9"|grep -v grep|awk '{print $1}'`
    ;;
esac
You need to adjust the zone ids based on your installation but for me it works just fine.
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: motion detection time option

Post by knight-of-ni »

You can currently use Zoneminder Run States to do this.

Set up the cameras the way you want the first state. Then click "Running" on the main screen, enter the name of your new state, call it "Daytime", and then hit save.

Now configure your cameras for the second state and save it as "Nighttime".

You can manualy switch between the two states or on a schedule via cronjob:

Code: Select all

0 6 * * * /usr/bin/zmpkg.pl daytime 
0 20 * * * /usr/bin/zmpkg.pl nighttime 
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
Post Reply