mirror of
https://github.com/brmlab/brmdoor.git
synced 2025-06-08 11:44:01 +02:00
brmd alert: Do not trigger on door open just after brmlab closed
This commit is contained in:
parent
e76e8f458d
commit
34a86f0c1a
1 changed files with 4 additions and 2 deletions
|
@ -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');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue