Page 1 of 1

motion detection time option

Posted: Tue Jan 15, 2013 8:06 pm
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.

Re: motion detection time option

Posted: Thu Mar 07, 2013 4:19 pm
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:

Re: motion detection time option

Posted: Thu Sep 05, 2013 1:21 am
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.

Re: motion detection time option

Posted: Thu Sep 05, 2013 6:13 pm
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