finished rdc_temperature_int_ext.php\ncontinued events.php (recurrence)
This commit is contained in:
		@@ -23,15 +23,12 @@ class rdc_temperature_int_ext extends hook
 | 
			
		||||
		global $indexDevices, $hooks;
 | 
			
		||||
		static $time;
 | 
			
		||||
		$portes = array();
 | 
			
		||||
		$state = -1;
 | 
			
		||||
		$status = -1;
 | 
			
		||||
		$msg = "";
 | 
			
		||||
 | 
			
		||||
		if (empty($time))	$time = now();
 | 
			
		||||
		$indoorTemp = $device->properties["indoortempc"]["value"];
 | 
			
		||||
		$portes = $hooks["alerte_intrusion"]->testPortes(false);
 | 
			
		||||
		foreach($portes as $value)
 | 
			
		||||
		{
 | 
			
		||||
			$msg .= $value . "\n";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		if ( $value > $indoorTemp)
 | 
			
		||||
		{
 | 
			
		||||
@@ -57,13 +54,26 @@ class rdc_temperature_int_ext extends hook
 | 
			
		||||
			}
 | 
			
		||||
			logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, bool2string($value)), __FILE__ . ":" . __LINE__, $device);
 | 
			
		||||
		}
 | 
			
		||||
		$portes = $hooks["alerte_intrusion"]->testPortes(false, true);
 | 
			
		||||
		if ($status == 1)
 | 
			
		||||
		{
 | 
			
		||||
			//if ($time - DateTime();
 | 
			
		||||
			//logger(ALERT, _("Open doors to climate"),  null ,$device);
 | 
			
		||||
			if (empty($portes) and ($time->diff(now())->format("i")) > 5)
 | 
			
		||||
			{
 | 
			
		||||
				logger(ALERT, _("Open doors to climate"), null, $device);
 | 
			
		||||
				$time = now();
 | 
			
		||||
			}
 | 
			
		||||
		}else
 | 
			
		||||
		{
 | 
			
		||||
			//logger(ALERT, _("Close doors to climate\n") . $msg, null, $device);
 | 
			
		||||
			//$portes = $hooks["alerte_intrusion"]->testPortes(false, true);
 | 
			
		||||
			if (!empty($portes) and ($time.diff(now()).format("i") > 5))
 | 
			
		||||
			{
 | 
			
		||||
				$time = now();
 | 
			
		||||
				foreach($portes as $porte)
 | 
			
		||||
				{
 | 
			
		||||
					$msg .= $porte . "\n";
 | 
			
		||||
					logger(ALERT, _("Close doors to climate\n") . $msg, null, $device);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user