From b93b27bb97800ec07fe9896da1fd8849d6f8d3cd Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Thu, 20 Oct 2011 14:25:26 +0200 Subject: [PATCH] brmd alert condition: Consider dangerous opens also in case of status manual override active --- brmd/brmd.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/brmd/brmd.pl b/brmd/brmd.pl index f82e179..bacf59f 100755 --- a/brmd/brmd.pl +++ b/brmd/brmd.pl @@ -14,6 +14,7 @@ our $devdoor = $ARGV[0]; $devdoor ||= "/dev/serial/by-id/usb-FTDI_FT232R_USB_UAR our $devasign = $ARGV[1]; $devasign ||= "/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0"; our ($status, $streaming, $dooropen, $topic) = (0, 0, 0, 'BRMLAB OPEN'); our ($laststchange, $lastunlock) = (0, 0); +our $stmanual = 0; my $irc = brmd::IRC->new(); my $web = brmd::WWW->new(); @@ -71,6 +72,7 @@ sub status_update { my ($self, $newstatus, $manual, $nick) = @_[OBJECT, ARG0 .. ARG2]; $status = $newstatus; my $st = status_str(); + $stmanual = $manual; if ($manual) { $poe_kernel->post($door, 'status_override', $status); @@ -101,7 +103,7 @@ sub dooropen_update { my $closed_timeout = 60; my $unlock_timeout = 30; - my $alert = ($dooropen == 1 and $status == 0 and time - $laststchange >= $closed_timeout and time - $lastunlock >= $unlock_timeout); + my $alert = ($dooropen == 1 and ($status == 0 or $stmanual) and time - $laststchange >= $closed_timeout and time - $lastunlock >= $unlock_timeout); if ($alert) { $poe_kernel->post($door, 'play_alarm'); }