Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

brmd alert condition: Consider dangerous opens also in case of status…

… manual override active
  • Loading branch information...
commit b93b27bb97800ec07fe9896da1fd8849d6f8d3cd 1 parent d617d79
Petr Baudis authored October 20, 2011

Showing 1 changed file with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. 4  brmd/brmd.pl
4  brmd/brmd.pl
@@ -14,6 +14,7 @@
14 14
 our $devasign = $ARGV[1]; $devasign ||= "/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0";
15 15
 our ($status, $streaming, $dooropen, $topic) = (0, 0, 0, 'BRMLAB OPEN');
16 16
 our ($laststchange, $lastunlock) = (0, 0);
  17
+our $stmanual = 0;
17 18
 
18 19
 my $irc = brmd::IRC->new();
19 20
 my $web = brmd::WWW->new();
@@ -71,6 +72,7 @@ sub status_update {
71 72
 	my ($self, $newstatus, $manual, $nick) = @_[OBJECT, ARG0 .. ARG2];
72 73
 	$status = $newstatus;
73 74
 	my $st = status_str();
  75
+	$stmanual = $manual;
74 76
 
75 77
 	if ($manual) {
76 78
 		$poe_kernel->post($door, 'status_override', $status);
@@ -101,7 +103,7 @@ sub dooropen_update {
101 103
 
102 104
 	my $closed_timeout = 60;
103 105
 	my $unlock_timeout = 30;
104  
-	my $alert = ($dooropen == 1 and $status == 0 and time - $laststchange >= $closed_timeout and time - $lastunlock >= $unlock_timeout);
  106
+	my $alert = ($dooropen == 1 and ($status == 0 or $stmanual) and time - $laststchange >= $closed_timeout and time - $lastunlock >= $unlock_timeout);
105 107
 	if ($alert) {
106 108
 		$poe_kernel->post($door, 'play_alarm');
107 109
 	}

0 notes on commit b93b27b

Please sign in to comment.
Something went wrong with that request. Please try again.