added events configuration
This commit is contained in:
		
							
								
								
									
										4
									
								
								config/events.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								config/events.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
@@ -11,10 +11,6 @@ class alerte_intrusion extends hook
 | 
			
		||||
		RDC_SALON_BAIE => "contact"
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
	public $delay = 3;				// amount of time in $timeunit
 | 
			
		||||
	public $delayManual = 10;		// amount of time in $timeunit for manual mode
 | 
			
		||||
	public $timeUnit = "minute";	// unit of time for delay, second, minute, day, week, month, year
 | 
			
		||||
 | 
			
		||||
	// callback fonction. Is called with these 4 parameters
 | 
			
		||||
	public function callBack($device, $property, $value)
 | 
			
		||||
	{
 | 
			
		||||
@@ -29,6 +25,23 @@ class alerte_intrusion extends hook
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function test()
 | 
			
		||||
	{
 | 
			
		||||
		global $indexDevices;
 | 
			
		||||
		$msg = "";
 | 
			
		||||
		foreach ($this->devicelist as $device => $property)
 | 
			
		||||
		{
 | 
			
		||||
			if($indexDevices[$device]->properties[$property] != false)
 | 
			
		||||
			{
 | 
			
		||||
				$msg .= $indexDevices->friendlyName . " is open" . EOL;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if ($msg != "")
 | 
			
		||||
		{
 | 
			
		||||
			logger(ALERT, $msg, __FILE__ . ":" . __LINE__);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$hooks["alerte_intrusion"] = new alerte_intrusion();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user