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.
Alarm Audio Per Zone on Server
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
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
Why don't you just use the script below and make your PC speaker beeps on every alarm?
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
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.
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 );
}
Code: Select all
print ( `echo '$monitor->{Name} has alarmed' | smbclient -M office_desktop` );
My question too.insippo wrote:where you to save this script? I have debian lenny for zoneminder
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.