I've recently decided to use the the on-camera motion detection feature of the AXIS 207 cameras that we have been using. (Motion detection with ZM puts a lot of burden on the server; if one has more than 5-6 cameras, the ZM server must be really a powerful computer).
The new (most recent) AXIS-207 firmware allows the camera to send a tcp message to zmtrigger.pl running on a predefined server once some motion is detected by the camera.
I had described how I set up my Axis207 and ZM to utilize the on-camera motion detection here http://www.zoneminder.com/forums/viewto ... highlight=
The message sent by the camera to ZM has the format:
Code: Select all
mon_id|on 20|score|some text|some other text
Code: Select all
8|on 20|50|Alarm on cam 8|Camera detected some motion
recording starts immediately when the `on` message is received and an 'event cancel' action is scheduled for current_time+20 seconds.
The AXIS 207 fires messages everytime it detects motion and this firing continues every few seconds as long as the motion continues. The problem is that; when a motion is detected at t=1. recording starts at t=1 but a "cancel" action is scheduled to t=21 and no matter what is going on; recording stops at t=21. In real life, in case of continuing motion; one wants recording to be continued as long as the motion continues. That is to say, a motion detection occurring at t=12 should extend recording till t=32. With the current zmtrigger.pl, a "recording cancel" action is scheduled at t=21 once a message is received at t=1 telling zmtrigger to record for 20 seconds.
I've modified zmtrigger.pl so that if a "start recording" message is received while the camera is in alarm state (that is: it is already recording): the previous `cancel` action will be cancelled and a new cancel action will be scheduled for t+20. This way I can record the whole motion completely regardless of its duration.
My code modification on the zmtrigger.pl file to cancel a "cancel" action when a message is received for cameras already in alarm state is in the following block:
Frankly; I couldn't simply delete a scheduled 'cancel' event in the complicated data structure maintained by zmtrigger but; instead i set the camera ID of a previously set action to 999. The cost of this is having a warning message complaining that camera `999` cannot be found. No worries with that...
Code: Select all
if ( $delay )
{
my $action_time = time()+$delay;
my $action_text = $id."|cancel";
my $action_array = $actions{$action_time};
if ( !$action_array )
{
$action_array = $actions{$action_time} = [];
}
#
if ( zmInAlarm($monitor) ) {
# delete any previously registered "cancel" time event(s) for this monitor
foreach my $cua_key (keys(%actions)) {
foreach my $cua_action ( @{$actions{$cua_key}} )
{
my $cua_message = $cua_action->{message};
my $cua_connection = $cua_action->{connection};
if ($cua_message eq $id."|cancel") {
$cua_action->{message} = '999|cancel';
}
}
}
}
push( @$action_array, { connection=>$connection, message=>$action_text } );