Alarm Audio Per Zone on Server

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
roach
Posts: 7
Joined: Sat Apr 12, 2008 1:24 am

Alarm Audio Per Zone on Server

Post by roach »

An alarm audio that sounds on the server rather than through the web interface as it currently is.

Ability to assign a different alarm audio file to each camera. Ability to have no sound on some cameras and sound on others. All server side.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Good suggestions here. We have discussed using something like 'beep' on the server but many machines just don't have audio hardware, even to make a beep, on any more, or don't support the interface. If you have hardware that does then using a trigger script (a la zmtrigger) to listen out for alarms and make the noises is relatively simple to set up.
Phil
ktheking
Posts: 70
Joined: Fri Oct 12, 2007 11:53 am

Post by ktheking »

Hence the reason why a microcontroller for ZM is needed. (still nothing there :oops: ,didn't get it running yet)
User avatar
robi
Posts: 477
Joined: Sat Mar 17, 2007 10:48 am

Post by robi »

Most mobos have onboard soundcards, and every mobo has pc speaker, for bios beeps.
v1.25.0 + Ubuntu Linux 12.04 Server
ma6inista
Posts: 3
Joined: Tue Aug 14, 2007 6:15 pm
Contact:

Post by ma6inista »

Why don't you just use the script below and make your PC speaker beeps on every alarm?

Code: Select all

#!/usr/bin/perl -w

use strict;

use ZoneMinder;

$| = 1;

zmDbgInit( "myscript", level=>0, to_log=>0, to_syslog=>0, to_term=>1 );

my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_HOST, ZM_DB_USER, ZM_DB_PASS );

my $sql = "select M.*, max(E.Id) as LastEventId from Monitors as M left join Events as E on M.Id = E.MonitorId where M.Function != 'None' group by 
(M.Id)";
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() );
my @monitors;
while ( my $monitor = $sth->fetchrow_hashref() )
{
    push( @monitors, $monitor );
}

while( 1 )
{
    foreach my $monitor ( @monitors )
    {
        next if ( !zmShmVerify( $monitor ) );

        if ( my $last_event_id = zmHasAlarmed( $monitor, $monitor->{LastEventId} ) )
        {
            $monitor->{LastEventId} = $last_event_id;
            print( "Monitor ".$monitor->{Name}." has alarmed\n" );
            print ( `echo -e "\a" > /dev/console` );
            sleep( 5 );
            
            
        }
    }
    sleep( 5 );
}
It worked for me for a while until I moved the server to another room. Then I used "smbclient" to send a popup message to my Windows desktop by adding this

Code: Select all

 print ( `echo '$monitor->{Name} has alarmed' | smbclient -M office_desktop` );
Works like a charm, the server still beeps in the computer room and I get a pop up message on my office machine for every alarm.
insippo
Posts: 39
Joined: Mon Dec 27, 2010 11:45 am
Location: estonia

Post by insippo »

where you to save this script? I have debian lenny for zoneminder
wkulecz
Posts: 36
Joined: Thu Mar 15, 2007 12:34 pm

Post by wkulecz »

insippo wrote:where you to save this script? I have debian lenny for zoneminder
My question too.

Also what defines zmHasAlarmed? One alarm frame?

In a Mdetect event I often see only 10% of the frames are alarm frames so I filter on number of alarm frames before sending an Email of the event, is the zmHasAlarmed tied to one per event or if the event has multiple bursts of alarm frames would I get multiple zmHasAlarmed true? Is the sleep(5) a kludge around this issue?

I'd like this to be a minimum number of alarm frames before declaring it an "event" worthy of barking at me.

What if I set to_term=>1 to be 0 instead and remove the print statements, would this make it a daemon scrip running in the background?

Its nice to have a perl "API" but without a bit of useful documentation (examples are the *best* documentation) its asking a lot to know enough perl to figure out what the API is doing before being able to use it.
Your commitment to Freedom is measured by your tolerance of others doing things you disapprove.
Post Reply