debugage
This commit is contained in:
		@@ -26,14 +26,16 @@ class rdc_sdb_eclairage extends hook
 | 
			
		||||
	// callback fonction. Is called with these 3 parameters
 | 
			
		||||
	public function callBack(&$device, $property, $value)
 | 
			
		||||
	{
 | 
			
		||||
		global $devices, $indexDevices;
 | 
			
		||||
		global $indexDevices;
 | 
			
		||||
		//var_dump($value);
 | 
			
		||||
		$deviceTarget = $indexDevices[RDC_SDB_WC_ECLAIRAGE];
 | 
			
		||||
 | 
			
		||||
		switch($property)
 | 
			
		||||
		{
 | 
			
		||||
			case "occupancy":
 | 
			
		||||
				if ($value == ON)
 | 
			
		||||
				{
 | 
			
		||||
					if (getValue(RDC_SDB_WC_ECLAIRAGE, "state_l1") != "ON")
 | 
			
		||||
					if (getValue($deviceTarget->ieeeAddress, "state_l1") != "ON")
 | 
			
		||||
					{
 | 
			
		||||
						$this->send("ON");
 | 
			
		||||
					}
 | 
			
		||||
@@ -42,13 +44,13 @@ class rdc_sdb_eclairage extends hook
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			case "state_l1":
 | 
			
		||||
				if ($value == ON)
 | 
			
		||||
				if ($value == "ON")
 | 
			
		||||
				{
 | 
			
		||||
					setDelay($indexDevices[RDC_SDB_WC_ECLAIRAGE], $this->delayManual, $this->timeUnit, "state_l1", "OFF", true);
 | 
			
		||||
					setDelay($deviceTarget, $this->delay, $this->timeUnit, "state_l1", "OFF", true);
 | 
			
		||||
					$device->method = MANUAL;
 | 
			
		||||
				}elseif ($value = OFF)
 | 
			
		||||
				}elseif ($value = "OFF")
 | 
			
		||||
				{
 | 
			
		||||
					removeEvent($indexDevices[RDC_SDB_WC_ECLAIRAGE], "state_l1", "OFF");
 | 
			
		||||
					removeEvent($deviceTarget, "state_l1", "OFF");
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
@@ -57,13 +59,12 @@ class rdc_sdb_eclairage extends hook
 | 
			
		||||
 | 
			
		||||
	private function send($state)
 | 
			
		||||
	{
 | 
			
		||||
		global $devices, $indexDevices;
 | 
			
		||||
		global $indexDevices;
 | 
			
		||||
		$msg = array("state_l1" => $state);
 | 
			
		||||
		$device = & $indexDevices[RDC_SDB_WC_ECLAIRAGE];
 | 
			
		||||
		$device = &$indexDevices[RDC_SDB_WC_ECLAIRAGE];
 | 
			
		||||
		logger(INFO, sprintf(_("publishing message: %s to %s"), $state, $device->friendlyName), __FILE__ . ":" . __LINE__);
 | 
			
		||||
		$device->payload = $msg;
 | 
			
		||||
		$device->set(null);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
$hooks["rdc_sdb_eclairage"] = new rdc_sdb_eclairage();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user