Multi user, different cam alert

Forum for questions and support relating to the 1.30.x releases only.
Locked
opi
Posts: 1
Joined: Tue Oct 25, 2016 4:59 am

Multi user, different cam alert

Post by opi »

Hello

I have 3 users and 9 cams.
How can I config to send cam alert specified address

CAM1,2,3 --alert-> User1 address
CAM4,5,6 --alert-> User1 and User2 address
CAM7,8,8 --alert-> User3 address

Thanks a lot
Daniel
rockedge
Posts: 1199
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Multi user, different cam alert

Post by rockedge »

use a script that monitors if an event occurs by polling zmTrigger.pl or something like this example:

Code: Select all

#!/usr/bin/env perl
# While this script is running, it will print out the state of each alarm on the system.
# This script is an example of calling external scripts in reaction to a
# monitor changing state. Simply replace the print() commands with system(),
# for example, to call external scripts.
use strict;
use warnings;
use ZoneMinder;
use Switch;
$| = 1;
my @monitors;
my $dbh = zmDbConnect();
my $sql = "SELECT * FROM Monitors";
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute() or die( "Can't execute '$sql': ".$sth->errstr() );
while ( my $monitor = $sth->fetchrow_hashref() ) {
push( @monitors, $monitor );
}
while (1) {
foreach my $monitor (@monitors) {
my $monitorState = zmGetMonitorState($monitor);
printState($monitor->{Id}, $monitor->{Name}, $monitorState);
}
sleep 1;
}
sub printState {
my ($monitor_id, $monitor_name, $state) = @_;
my $time = localtime();
switch ($state) {
case 0 { print "$time - $monitor_name:\t Idle!\n" }
case 1 { print "$time - $monitor_name:\t Prealarm!\n" }
case 2 { print "$time - $monitor_name:\t Alarm!\n" }
case 3 { print "$time - $monitor_name:\t Alert!\n" }
}
}
file located here : https://github.com/ZoneMinder/ZoneMinde ... m-alarm.pl

with some modification can be used to set up logic to send the event notice to different addresses according to which camera is throwing the event.
look into using zmTrigger.pl and see some examples of how to use it.
Locked