Ver Fonte

Hit on the master state AND motion detectors (if enabled)

Zachary Kotlarek há 12 anos atrás
pai
commit
48713c5862
1 ficheiros alterados com 7 adições e 3 exclusões
  1. 7 3
      dmx/state.pl

+ 7 - 3
dmx/state.pl

@@ -576,11 +576,15 @@ while (1) {
 		$state = 'OFF';
 	}
 
-	# ALARM if LOCK exists and the master state is not OFF
+	# ALARM if LOCK exists and the master state is not OFF or any motion exists
 	{
 		my $alarm = 0;
-		if (exists($files{'LOCK'}) && $files{'LOCK'}->{'value'} && $state ne 'OFF') {
-			$alarm = 1;
+		if (exists($files{'LOCK'}) && $files{'LOCK'}->{'value'}) {
+			if ($state ne 'OFF' ||
+				(exists($files{'MOTION'}) && $files{'MOTION'}->{'value'}) ||
+				(exists($files{'MOTION_STAIRS'}) && $files{'MOTION_STAIRS'}->{'value'})) {
+					$alarm = 1;
+			}
 		}
 		if (!exists($files{'ALARM'}->{'value'}) || $files{'ALARM'}->{'value'} != $alarm) {
 			$files{'ALARM'}->{'update'} = $now;