function WinLIRC_doSendData($Control, $Button) { $ModuleId = get_CommConfigValue(c_Comm_WinLIRC, c_Property_Instance); IPSLogger_Com(__file__, "Send Data to WinLIRC, Control='$Control', Command='$Button' (Module=$ModuleId)"); if ($ModuleId!==false and $ModuleId<>"") { if (@IRT_SendOnce($ModuleId, $Control, $Button)==false) { IPSLogger_Wrn(__file__, "Unknown IRTrans Message, Control='$Control', Command='$Button' (Module=$ModuleId)"); }; } }
function IPSModuleManagerGUI_GetLock($action='', $refresh=false) { $result = IPS_SemaphoreEnter('IPSModuleManagerGUI', 10); if (!$result and $action<>'') { IPSLogger_Wrn(__file__, 'IPSModuleManager Action "'.$action.'" ignored - other Action already in progess!!!'); } if ($refresh) { IPSModuleManagerGUI_Refresh(); } return $result; }
function get_ControlNameByDeviceName($DeviceName, $ControlType, $ErrorOnNotFound=true) { $DeviceData = get_DeviceConfiguration(); if (!array_key_exists($DeviceName, $DeviceData)) { IPSLogger_Wrn(__file__, 'Unknown DeviceName "'.$DeviceName.'"'); return false; } $Device = $DeviceData[$DeviceName]; if (array_key_exists($ControlType, $Device)) { return $DeviceData[$DeviceName][$ControlType][c_Property_Name]; } if ($ErrorOnNotFound) { IPSLogger_Err(__file__, "ControlName could NOT be found for Device='$DeviceName' and ControlType='$ControlType'"); exit; } return false; }
$CircleName = IPS_GetName($_IPS['EVENT']); $categoryId_Circles = IPSUtil_ObjectIDByPath('Program.IPSLibrary.data.modules.IPSWatering.WaterCircles'); $CircleId = IPS_GetCategoryIDByName($CircleName, $categoryId_Circles); $ControlId = get_ControlId(c_Control_Active, $CircleId); $WaterConfig = get_WateringConfiguration(); // Wert von Bewässerungs Sensor ermitteln $SensorLimit = GetValue(get_ControlId(c_Control_Sensor, $CircleId)); $SensorValue = false; if (array_key_exists(c_Property_Sensor, $WaterConfig[$CircleName])) { $SensorPath = $WaterConfig[$CircleName][c_Property_Sensor]; if ($SensorPath <> '') { $SensorId = IPSUtil_ObjectIDByPath($SensorPath); if ($SensorId===false) { IPSLogger_Wrn(__file__, "Specified Sensor '$SensorPath' could NOT be found"); } else { $SensorValue = GetValue($SensorId); } } } if ($SensorValue===false and $SensorLimit>0) { IPSLogger_Err(__file__, "Rainfall Sensor NOT defined for Circle '$CircleName'"); Exit; } // Bewässerung Starten if ($SensorLimit > 0 and $SensorValue!==false and $SensorLimit<=$SensorValue) { IPSWatering_LogNoActivationByRainfall($CircleId, $SensorLimit, $Rainfall); IPSWatering_CalcNextScheduleDateTime($CircleId);
/** * @public * * Ermöglicht das Verarbeiten eines Taster Signals * */ public function ExecuteButton () { switch ($this->lightFunction) { case 'IPSLight_DimAbsoluteByName': IPSLight_DimAbsoluteByName($this->lightObject, $this->lightValue); break; case 'IPSLight_DimRelativByName': IPSLight_DimRelativByName($this->lightObject, $this->lightValue); break; case 'IPSLight_SetSwitchByName': IPSLight_SetSwitchByName($this->lightObject, $this->lightValue); break; case 'IPSLight_ToggleSwitchByName': IPSLight_ToggleSwitchByName($this->lightObject); break; case 'IPSLight_SetGroupByName': IPSLight_SetGroupByName($this->lightObject, $this->lightValue); break; case 'IPSLight_ToggleGroupByName': IPSLight_ToggleGroupByName($this->lightObject); break; case 'IPSLight_SetProgramNextByName': IPSLight_SetProgramNextByName($this->lightObject); break; case 'IPSLight_SetProgramName': IPSLight_SetProgramName($this->lightObject, $this->lightValue); break; default: IPSLogger_Wrn(__file__, 'Unknown Button Function "'.$this->lightFunction.'"'); } }
/** * @public * * Methode um autretende Events zu processen * * @param integer $variable ID der auslösenden Variable * @param string $value Wert der Variable */ public function HandleEvent($variable, $value) { $configurationAuto = self::Get_EventConfigurationAuto(); $configurationCust = self::Get_EventConfigurationCust(); if (array_key_exists($variable, $configurationCust)) { $params = $configurationCust[$variable]; } elseif (array_key_exists($variable, $configurationAuto)) { $params = $configurationAuto[$variable]; //} elseif ($variable==IPSMH_IRTRANS_BUTTON_VARIABLE_ID) { //$params = ''; //$this->HandleIREvent($variable, $value); } else { $params = ''; IPSLogger_Wrn(__file__, 'Variable '.$variable.' NOT found in IPSMessageHandler Configuration!'); } if ($params<>'') { if (count($params) < 3) { throw new IPSMessageHandlerException('Invalid IPSMessageHandler Configuration, Event Defintion needs 3 parameters'); } $component = IPSComponent::CreateObjectByParams($params[1]); $module = IPSModule::CreateObjectByParams($params[2]); if (function_exists('IPSMessageHandler_BeforeHandleEvent')) { if (IPSMessageHandler_BeforeHandleEvent($variable, $value, $component, $module)) { $component->HandleEvent($variable, $value, $module); if (function_exists('IPSMessageHandler_AfterHandleEvent')) { IPSMessageHandler_AfterHandleEvent($variable, $value, $component, $module); } } } else { $component->HandleEvent($variable, $value, $module); if (function_exists('IPSMessageHandler_AfterHandleEvent')) { IPSMessageHandler_AfterHandleEvent($variable, $value, $component, $module); } } } }
CreateLink('Logging Level', $ID_ProwlOutLevel, $ID_Output, 20); CreateLink('Priority', $ID_ProwlOutPriority, $ID_Output, 30); } Register_PhpErrorHandler($moduleManager); // ---------------------------------------------------------------------------------------------------------------------------- // Some Tests // ---------------------------------------------------------------------------------------------------------------------------- IPSUtils_Include ("IPSLogger.inc.php", "IPSLibrary::app::core::IPSLogger"); // Some Test Messages IPSLogger_Fat(__file__, 'Test for a Fatal Error'); IPSLogger_Err(__file__, 'Test for a Error ...'); IPSLogger_Wrn(__file__, 'Test for a Warning'); IPSLogger_Not(__file__, 'Test for a Notification with Priority 0 (High)'); IPSLogger_Not(__file__, 'Test for a Notification with Priority 10 (Low)'); IPSLogger_Inf(__file__, 'Test for a Information Message ...'); IPSLogger_Dbg(__file__, 'Test for a Debug Message ...'); IPSLogger_Com(__file__, 'Test for a Communication Message ...'); IPSLogger_Trc(__file__, 'Test for a Trace Message ...'); IPSLogger_Tst(__file__, 'Test for a Test Message ...'); // ------------------------------------------------------------------------------------------------ function Register_PhpErrorHandler($moduleManager) { $file = IPS_GetKernelDir().'scripts\\__autoload.php'; if (!file_exists($file)) { throw new Exception($file.' could NOT be found!', E_USER_ERROR); }