diff --git a/brmd/brmd.pl b/brmd/brmd.pl index 850a7eb..e7059cf 100755 --- a/brmd/brmd.pl +++ b/brmd/brmd.pl @@ -13,7 +13,7 @@ our $streamurl = "http://brmlab.cz/stream"; our $devdoor = $ARGV[0]; $devdoor ||= "/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A700e1qB-if00-port0"; 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 $lastunlock = 0; +our ($laststchange, $lastunlock) = (0, 0); my $irc = brmd::IRC->new(); my $web = brmd::WWW->new(); @@ -77,6 +77,8 @@ sub status_update { } $poe_kernel->post( $irc, 'notify_update', 'brmstatus', $st, undef, $manual, $nick ); + + $laststchange = time; } sub streaming_update { @@ -99,7 +101,7 @@ sub dooropen_update { my $closed_timeout = 60; my $unlock_timeout = 30; - my $alert = ($dooropen == 1 and $status == 0 and time - $lastunlock >= $unlock_timeout); + my $alert = ($dooropen == 1 and $status == 0 and time - $laststchange >= $closed_timeout and time - $lastunlock >= $unlock_timeout); if ($alert) { $poe_kernel->post($door, 'play_alarm'); }