Latest version of zmAlarmServer

This commit is contained in:
ovargasp
2022-08-05 16:46:11 -06:00
committed by Isaac Connor
parent ce35b40c60
commit 96f7cd7a4e
4 changed files with 74 additions and 2 deletions

View File

@@ -3834,6 +3834,53 @@ our @options = (
type => $types{string},
category => 'config',
},
# Add options for Alarm Server
{
name => 'ZM_OPT_USE_ALARMSERVER',
default => 'no',
description => 'Enable NETSurveillance WEB Camera ALARM SERVER',
help => q`
Alarm Server that works with cameras that use Netsurveillance Web Server,
and has the Alarm Server option it receives alarms sent by this cameras
(once enabled), and pass to Zoneminder the events.
It requires pyzm installed, visit https://pyzm.readthedocs.io/en/latest/
for installation instructions.
`,
type => $types{boolean},
category => 'system',
},
{
name => 'ZM_OPT_ALS_LOGENTRY',
default => 'no',
description => 'Makes ALARM SERVER create a log entry in ZoneMinder on Human Detected',
help => '',
type => $types{boolean},
category => 'system',
},
{
name => 'ZM_OPT_ALS_ALARM',
default => 'no',
description => 'Send the Human Detected alarm from ALARM SERVER to ZoneMinder, It does not work along with OPT_ALS_TRIGGEREVENT',
help => '',
type => $types{boolean},
category => 'system',
},
{
name => 'ZM_OPT_ALS_TRIGGEREVENT',
default => 'no',
description => 'Trigger an event on Human Detected alarm from ALARM SERVER to ZoneMinder. Requires the zmTrigger option Enabled',
help => '',
type => $types{boolean},
category => 'system',
},
{
name => 'ZM_OPT_ALS_PORT',
default => '15002',
description => 'Port Number to receive alarms from Alarm Server',
help => '',
type => $types{integer},
category => 'system',
},
);
our %options_hash = map { ( $_->{name}, $_ ) } @options;

View File

@@ -108,7 +108,7 @@ if len(sys.argv) > 1:
else:
print('Usage: %s [--port|-p=<value> --log|-l=<y/n> --alarm|-a=<y/n> --event|-e=<y/n>]' % os.path.basename(sys.argv[0]))
sys.exit()
sys.exit(1)
print ('Create log entry: ', wrzmlog)
print ('Trigger event: ', wrzmlog)

View File

@@ -102,7 +102,8 @@ my @daemons = (
'zmtrack.pl',
'zmcontrol.pl',
'zm_rtsp_server',
'zmtelemetry.pl'
'zmtelemetry.pl',
'zmalarm-server.py'
);
if ( $Config{ZM_OPT_USE_EVENTNOTIFICATION} ) {

View File

@@ -288,6 +288,30 @@ if ( $command =~ /^(?:start|restart)$/ ) {
if ( $Config{ZM_MIN_RTSP_PORT} ) {
runCommand('zmdc.pl start zm_rtsp_server');
}
# run and pass parameters to AlarmServer.py
if ($Config{ZM_OPT_USE_ALARMSERVER} ) {
my $cmd='zmdc.pl start zmalarm-server.py '. $Config{ZM_OPT_ALS_PORT};
if ($Config{ZM_OPT_ALS_LOGENTRY} ) {
$cmd = $cmd . ' --log=y';
}
else {
$cmd = $cmd . ' --log=n';
}
if ($Config{ZM_OPT_ALS_TRIGGEREVENT} ) {
$cmd = $cmd . ' --event=y';
}
else {
$cmd = $cmd . ' --event=n';
}
if ($Config{ZM_OPT_ALS_ALARM} ) {
$cmd = $cmd . ' --alarm=y';
}
else {
$cmd = $cmd . ' --alarm=n';
}
runCommand($cmd);
}
} else {
$retval = 1;
}