/** * constructor * * @throws Exception if $type is not valid * @access public */ public function __construct($parentId, $name, $content, $debug = false) { $this->parentId = $parentId; $this->name = $name; $this->content = $content; $this->debug = $debug; $this->id = @IPS_GetScriptIDByName($this->name, $this->parentId); //check if event does already exist if ($this->id == false) { if ($this->debug) { echo "INFO - create IPS script {$name}\n"; } $this->id = IPS_CreateScript(0); IPS_SetName($this->id, $this->name); IPS_SetParent($this->id, $this->parentId); IPS_SetScriptContent($this->id, $this->content); IPS_SetInfo($this->id, "this script was created by script " . $_IPS['SELF'] . " which is part of the ips-library (https://github.com/florianprobst/ips-library)"); } }
IPSUtils_Include ("NetPlayer_Constants.inc.php", "IPSLibrary::app::modules::NetPlayer"); IPSUtils_Include ("NetPlayer_Configuration.inc.php", "IPSLibrary::config::modules::NetPlayer"); // ---------------------------------------------------------------------------------------------------------------------------- // Program Installation // ---------------------------------------------------------------------------------------------------------------------------- echo "--- Create NetPlayer -------------------------------------------------------------------\n"; $CategoryIdData = $moduleManager->GetModuleCategoryID('data'); $CategoryIdApp = $moduleManager->GetModuleCategoryID('app'); $CategoryIdHw = CreateCategoryPath('Hardware.NetPlayer'); // Scripts $actionScriptId = IPS_GetScriptIDByName('NetPlayer_ActionScript', $CategoryIdApp); $eventScriptId = IPS_GetScriptIDByName('NetPlayer_EventScript', $CategoryIdApp); // Controls CreateProfile_Associations ('NetPlayer_Category', array('Root')); CreateProfile_Associations ('NetPlayer_CDAlbumList', array('...')); CreateProfile_Associations ('NetPlayer_CDAlbumNav', array('<<','>>')); CreateProfile_Associations ('NetPlayer_CDTrackList', array('...')); CreateProfile_Associations ('NetPlayer_CDTrackList2', array('xx', 'yyy')); CreateProfile_Associations ('NetPlayer_CDTrackNav', array('<<','>>')); CreateProfile_Associations ('NetPlayer_RadioList', array('...')); CreateProfile_Associations ('NetPlayer_RadioNav', array('<<','>>')); CreateProfile_Associations ('NetPlayer_Control', array('Play','Pause','Stop','<<','>>')); CreateProfile_Associations ('NetPlayer_Source', array('CD Player','Radio Player')); // MP3 Player $mp3PlayerInstanceId = CreateInstance("CDPlayer", $CategoryIdData, "{485D0419-BE97-4548-AA9C-C083EB82E61E}",1000);
$Mobile_Name = $moduleManager->GetConfigValue('Name', 'Mobile'); $Mobile_Order = $moduleManager->GetConfigValueInt('Order', 'Mobile'); $Mobile_Icon = $moduleManager->GetConfigValue('Icon', 'Mobile'); // ---------------------------------------------------------------------------------------------------------------------------- // Program Installation // ---------------------------------------------------------------------------------------------------------------------------- $Location = IPSTWILIGHT_LOCATION; $categoryId_Data = $moduleManager->GetModuleCategoryID('data'); $categoryId_App = $moduleManager->GetModuleCategoryID('app'); $categoryId_DataGraphics = CreateCategory('Graphics', $categoryId_Data, 10); $categoryId_DataValues = CreateCategory('Values', $categoryId_Data, 20); // Scripts $scriptId_Refresh = IPS_GetScriptIDByName('IPSTwilight', $categoryId_App); $timerId_Refresh = CreateTimer_OnceADay ('Refresh', $scriptId_Refresh, 0, 15) ; // Graphics $YearMediaId = CreateMedia ('IPSTwilight_Year', $categoryId_DataGraphics, IPS_GetKernelDir().'media\\IPSTwilight_Year.gif', false,1,'Sun'); $YearLimitedMediaId = CreateMedia ('IPSTwilight_YearLimited', $categoryId_DataGraphics, IPS_GetKernelDir().'media\\IPSTwilight_YearLimited.gif', false,1,'Sun'); $YearUnlimitedMediaId = CreateMedia ('IPSTwilight_YearUnlimited', $categoryId_DataGraphics, IPS_GetKernelDir().'media\\IPSTwilight_YearUnlimited.gif', false,1,'Sun'); $DayMediaId = CreateMedia ('IPSTwilight_Day', $categoryId_DataGraphics, IPS_GetKernelDir().'media\\IPSTwilight_Day.gif', false,1,'Sun'); $DayLimitedMediaId = CreateMedia ('IPSTwilight_DayLimited', $categoryId_DataGraphics, IPS_GetKernelDir().'media\\IPSTwilight_DayLimited.gif', false,1,'Sun'); $DayUnlimitedMediaId = CreateMedia ('IPSTwilight_DayUnlimited', $categoryId_DataGraphics, IPS_GetKernelDir().'media\\IPSTwilight_DayUnlimited.gif', false,1,'Sun'); //Data $DisplaySwitchId = CreateVariable('Display' , 0 /*Boolean*/, $categoryId_DataValues, 10, '~Switch',$scriptId_Refresh, false, 'Information'); $SunriseBeg = CreateVariable("SunriseBegin", 3 /*String*/, $categoryId_DataValues, 110, '~String', $scriptId_Refresh, ''); $SunriseEnd = CreateVariable("SunriseEnd", 3 /*String*/, $categoryId_DataValues, 120, '~String', $scriptId_Refresh, '');
<?php include_once "../modules/KH_UniFi/UniFi/orga.php"; $parentID = IPS_GetParent($_IPS["SELF"]); $wlanList = UniFi_GetWLANConfig($parentID); $setWLANID = IPS_GetScriptIDByName("setWLAN", $parentID); foreach ($wlanList->data as $wlan) { $ident = $wlan->_id; $rootCatID = CreateCategory("WLAN", "WLAN", $parentID); $catID = CreateCategory($wlan->name, $ident, $rootCatID); CreateVariable("ID", 3, $wlan->_id, $ident . "_id", $catID); CreateVariable("Enabled", 0, $wlan->enabled, $ident . "_enabled", $catID); $enabledID = IPS_GetVariableIDByName("Enabled", $catID); IPS_SetVariableCustomAction($enabledID, $setWLANID); IPS_SetVariableCustomProfile($enabledID, "~Switch"); CreateVariable("Security", 3, $wlan->security, $ident . "_security", $catID); }
public function toogleGoodNight() { $goodnightstate = GetValue($this->GetIDForIdent("GoodNight")); $sleeptimerstate = GetValue($this->GetIDForIdent("SleepTimer")); $sleeptimervariableid = @$this->GetIDForIdent("SleepTimer"); $sleeptimercontrolscriptid = @IPS_GetScriptIDByName("SleepTimerControl", $sleeptimervariableid); $sleeptimercontrolscripteventid = @IPS_GetEventIDByName("SleepTimerEvent", $sleeptimercontrolscriptid); if ($goodnightstate == false and $sleeptimerstate == false) { SetValue($this->GetIDForIdent("GoodNight"), true); SetValue($this->GetIDForIdent("VolumeFadeOut"), true); // set event $timenow = time(); $timestamp = strtotime('+900 seconds', $timenow); $nextpowerofftime = strtotime('+1800 seconds', $timenow); $hour = date("H", $timestamp); $minute = date("i", $timestamp); $second = date("s", $timestamp); IPS_SetEventCyclicTimeFrom($sleeptimercontrolscripteventid, $hour, $minute, $second); IPS_SetEventActive($sleeptimercontrolscripteventid, true); // set next power off $day = date("l", $nextpowerofftime); $date = date("d.m.Y", $nextpowerofftime); $time = date("H:i:s", $nextpowerofftime); $nextpoweroff = $day . ", " . $date . ", " . $time; SetValue($this->GetIDForIdent("NextPowerOff"), $nextpoweroff); // calculate cycle time $fadeoutseconds = 900; $actualvolume = GetValue($this->GetIDForIdent("VolumeSlider")); $cycletime = floor(900 / ($actualvolume - 1)); SetValue($this->GetIDForIdent("SleepCycle"), $cycletime); } if ($goodnightstate == true and $sleeptimerstate == false) { IPS_SetEventActive($sleeptimercontrolscripteventid, false); SetValue($this->GetIDForIdent("VolumeFadeOut"), false); SetValue($this->GetIDForIdent("GoodNight"), false); SetValue($this->GetIDForIdent("SleepCycle"), 0); SetValue($this->GetIDForIdent("NextPowerOff"), ""); } }
$Mobile_Path = $moduleManager->GetConfigValue('Path', 'Mobile'); $Mobile_PathOrder = $moduleManager->GetConfigValueInt('PathOrder', 'Mobile'); $Mobile_PathIcon = $moduleManager->GetConfigValue('PathOrder', 'Mobile'); $Mobile_Name = $moduleManager->GetConfigValue('Name', 'Mobile'); $Mobile_Order = $moduleManager->GetConfigValueInt('Order', 'Mobile'); $Mobile_Icon = $moduleManager->GetConfigValue('Icon', 'Mobile'); // ---------------------------------------------------------------------------------------------------------------------------- // Program Installation // ---------------------------------------------------------------------------------------------------------------------------- $categoryId_Data = $moduleManager->GetModuleCategoryID('data'); $categoryId_App = $moduleManager->GetModuleCategoryID('app'); // Scripts $scriptId_Refresh = IPS_GetScriptIDByName('IPSWeatherForcastAT_Refresh', $categoryId_App); $timerId_Refresh = CreateTimer_CyclicByMinutes ('Refresh', $scriptId_Refresh, 30) ; // Create Variables $LastRefreshDateTime = CreateVariable("LastRefreshDateTime", 3 /*String*/, $categoryId_Data, 10, '~String', null, ''); $LastRefreshTime = CreateVariable("LastRefreshTime", 3 /*String*/, $categoryId_Data, 20, '~String', null, ''); $TodaySeaLevel = CreateVariable("SeaLevel", 1 /*Integer*/, $categoryId_Data, 30, null, null, 0); $TodayAirHumidity = CreateVariable("AirHumidity", 3 /*String*/, $categoryId_Data, 40, '~String', null, ''); $TodayWind = CreateVariable("Wind", 3 /*String*/, $categoryId_Data, 50, '~String', null, ''); $TodayDayOfWeek = CreateVariable("TodayDay", 3 /*String*/, $categoryId_Data, 100, '~String', null, ''); $TodayTempCurrent = CreateVariable("TodayTempCurrent", 1 /*Integer*/, $categoryId_Data, 110, null, null, 0); $TodayTempMin = CreateVariable("TodayTempMin", 1 /*Integer*/, $categoryId_Data, 120, null, null, 0); $TodayTempMax = CreateVariable("TodayTempMax", 1 /*Integer*/, $categoryId_Data, 130, null, null, 0); $TodayIcon = CreateVariable("TodayIcon", 3 /*String*/, $categoryId_Data, 140, '~String', null, ''); $TodayTextShort = CreateVariable("TodayForecastLong", 3 /*String*/, $categoryId_Data, 150, '~String', null, '');
// ---------------------------------------------------------------------------------------------------------------------------- // Program Installation // ---------------------------------------------------------------------------------------------------------------------------- $CategoryIdData = $moduleManager->GetModuleCategoryID('data'); $CategoryIdApp = $moduleManager->GetModuleCategoryID('app'); $InstanceId = CreateDummyInstance("IPSLogger", $CategoryIdData, 0); CreateProfiles(); // Get Scripts Ids $ID_ScriptIPSLoggerChangeSettings = IPS_GetScriptIDByName('IPSLogger_ChangeSettings', $CategoryIdApp); $ID_ScriptIPSLoggerSendMail = IPS_GetScriptIDByName('IPSLogger_SendMail', $CategoryIdApp); $ID_ScriptIPSLoggerClearSingleOut = IPS_GetScriptIDByName('IPSLogger_ClearSingleOut', $CategoryIdApp); $ID_ScriptIPSLoggerClearHtmlOut = IPS_GetScriptIDByName('IPSLogger_ClearHtmlOut', $CategoryIdApp); $ID_ScriptIPSLoggerPurgeLogFiles = IPS_GetScriptIDByName('IPSLogger_PurgeLogFiles', $CategoryIdApp); CreateTimer ('IPSLogger_PurgeLogFilesTimer', $ID_ScriptIPSLoggerPurgeLogFiles, 8); // Add IPSLogger Variables $ID_SingleOutEnabled = CreateVariable('SingleOut_Enabled', 0 /*Boolean*/, $InstanceId, 100, '~Switch', $ID_ScriptIPSLoggerChangeSettings, true, 'Power'); $ID_SingleOutLevel = CreateVariable('SingleOut_Level', 1 /*Integer*/, $InstanceId, 110, 'IPSLogger_Level', $ID_ScriptIPSLoggerChangeSettings, 1 /*Error*/, 'Intensity'); $ID_SingleOutMsg = CreateVariable('SingleOut_Msg', 3 /*String*/, $InstanceId, 120, '~HTMLBox', null, "" , 'Window'); $ID_HtmlOutEnabled = CreateVariable('HtmlOut_Enabled', 0 /*Boolean*/, $InstanceId, 200, '~Switch', $ID_ScriptIPSLoggerChangeSettings, true, 'Power'); $ID_HtmlOutLevel = CreateVariable('HtmlOut_Level', 1 /*Integer*/, $InstanceId, 210, 'IPSLogger_Level', $ID_ScriptIPSLoggerChangeSettings, 9 /*All*/, 'Intensity'); $ID_HtmlOutMsgCount = CreateVariable('HtmlOut_MsgCount', 1 /*Integer*/, $InstanceId, 220, 'IPSLogger_MsgCount', $ID_ScriptIPSLoggerChangeSettings, 20, 'Distance'); $ID_HtmlOutMsgId = CreateVariable('HtmlOut_MsgId', 1 /*Integer*/, $InstanceId, 230, 'IPSLogger_MsgId', null, 0, 'Repeat'); $ID_HtmlOutMsgList = CreateVariable('HtmlOut_MsgList', 3 /*String*/, $InstanceId, 240, '~HTMLBox', null, "", 'Window'); $ID_IPSOutEnabled = CreateVariable('IPSOut_Enabled', 0 /*Boolean*/, $InstanceId, 300, '~Switch', $ID_ScriptIPSLoggerChangeSettings, true, 'Power'); $ID_IPSOutLevel = CreateVariable('IPSOut_Level', 1 /*Integer*/, $InstanceId, 310, 'IPSLogger_Level', $ID_ScriptIPSLoggerChangeSettings, 5 /*Debug*/, 'Intensity'); $ID_FileOutEnabled = CreateVariable('FileOut_Enabled', 0 /*Boolean*/, $InstanceId, 400, '~Switch', $ID_ScriptIPSLoggerChangeSettings, false, 'Power'); $ID_FileOutLevel = CreateVariable('FileOut_Level', 1 /*Integer*/, $InstanceId, 410, 'IPSLogger_Level', $ID_ScriptIPSLoggerChangeSettings, 5 /*Debug*/, 'Intensity');
$ConfigPath = "Program.IPSLibrary.config.hardware.IPSEDIP"; $HardwarePath = "Hardware.EDIP"; $IgnoreIOPortInstanceError = $moduleManager->GetConfigValueBoolDef('IgnoreIOPortInstanceError', '', true); /* ---------------------------------------------------------------------- */ /* EDIP Program Installation */ /* ---------------------------------------------------------------------- */ $CategoryIdData = CreateCategoryPath($DataPath); $CategoryIdApp = CreateCategoryPath($AppPath); $CategoryIdHW = CreateCategoryPath($HardwarePath); $id_ScriptTimer = IPS_GetScriptIDByName('IPSEDIP_Timer', $CategoryIdApp); $id_ScriptEvent = IPS_GetScriptIDByName('IPSEDIP_Event', $CategoryIdApp); $id_ScriptReceive = IPS_GetScriptIDByName('IPSEDIP_Receive', $CategoryIdApp); foreach (IPSEDIP_GetConfiguration() as $configItem=>$configData) { if ($configData[EDIP_CONFIG_ROOT]<>"") { $id_Instance = CreateDummyInstance($configItem, $CategoryIdData, 10); $id_Register = CreateVariable(EDIP_VAR_REGISTER, 1 /*Integer*/, $id_Instance, 10, '', null, 0); $id_Root = CreateVariable(EDIP_VAR_ROOT, 1 /*Integer*/, $id_Instance, 20, '', null, 0); $id_Current = CreateVariable(EDIP_VAR_CURRENT, 1 /*Integer*/, $id_Instance, 40, '', null, 0); $id_Categories = CreateVariable(EDIP_VAR_OBJECTIDS, 3 /*String*/, $id_Instance, 50, '', null, ''); $id_Variables = CreateVariable(EDIP_VAR_OBJECTCMDS, 3 /*String*/, $id_Instance, 60, '', null, ''); $id_Variables = CreateVariable(EDIP_VAR_OBJECTVALUES, 3 /*String*/, $id_Instance, 60, '', null, ''); $id_value = CreateVariable(EDIP_VAR_OBJECTEDIT, 1 /*Integer*/, $id_Instance, 70, '', null, 0); // Create Serial Port $id_IOComPort = null;
$WFC10_TabPaneName = $moduleManager->GetConfigValue('TabPaneName', 'WFC10'); $WFC10_TabPaneIcon = $moduleManager->GetConfigValue('TabPaneIcon', 'WFC10'); $WFC10_TabPaneOrder = $moduleManager->GetConfigValueInt('TabPaneOrder', 'WFC10'); $WFC10_TabItem = $moduleManager->GetConfigValue('TabItem', 'WFC10'); $WFC10_TabName = $moduleManager->GetConfigValue('TabName', 'WFC10'); $WFC10_TabIcon = $moduleManager->GetConfigValue('TabIcon', 'WFC10'); $WFC10_TabOrder = $moduleManager->GetConfigValueInt('TabOrder', 'WFC10'); // ---------------------------------------------------------------------------------------------------------------------------- // Program Installation // ---------------------------------------------------------------------------------------------------------------------------- $CategoryIdData = $moduleManager->GetModuleCategoryID('data'); $CategoryIdApp = $moduleManager->GetModuleCategoryID('app'); // Add Scripts $scriptIdSearchUpdates = IPS_GetScriptIDByName('IPSModuleManagerGUI_SearchUpdates', $CategoryIdApp); // Add Update Scripts $timerId_SearchUpdates = CreateTimer_OnceADay ('SearchUpdates', $scriptIdSearchUpdates, rand(0,4), rand(0,59)) ; // =================================================================================================== // Add Module Details // =================================================================================================== $variableIdStatus = CreateVariable(IPSMMG_VAR_ACTION, 3 /*String*/, $CategoryIdData, 10, '~String', null, 'Overview', ''); $variableIdModule = CreateVariable(IPSMMG_VAR_MODULE, 3 /*String*/, $CategoryIdData, 20, '~String', null, '', ''); $variableIdInfo = CreateVariable(IPSMMG_VAR_INFO, 3 /*String*/, $CategoryIdData, 30, '~String', null, '', ''); $variableIdHTML = CreateVariable(IPSMMG_VAR_HTML, 3 /*String*/, $CategoryIdData, 40, '~HTMLBox', null, '<iframe frameborder="0" width="100%" height="600px" src="../user/IPSModuleManagerGUI/IPSModuleManagerGUI.php"</iframe>', 'Information'); // ---------------------------------------------------------------------------------------------------------------------------- // Webfront Installation
$Mobile_Path = $moduleManager->GetConfigValue('Path', 'Mobile'); $Mobile_PathOrder = $moduleManager->GetConfigValueInt('PathOrder', 'Mobile'); $Mobile_PathIcon = $moduleManager->GetConfigValue('PathIcon', 'Mobile'); // ---------------------------------------------------------------------------------------------------------------------------- // Program Installation // ---------------------------------------------------------------------------------------------------------------------------- $CategoryIdData = $moduleManager->GetModuleCategoryID('data'); $CategoryIdApp = $moduleManager->GetModuleCategoryID('app'); // Add Scripts $ScriptIdChangeSettings = IPS_GetScriptIDByName('IPSWatering_ChangeSettings', $CategoryIdApp); $ScriptIdRefreshTimer = IPS_GetScriptIDByName('IPSWatering_RefreshTimer', $CategoryIdApp); $ScriptIdActivationTimer = IPS_GetScriptIDByName('IPSWatering_ActivationTimer', $CategoryIdApp); $ScriptIdAutomaticOn = IPS_GetScriptIDByName('IPSWatering_AutomaticOn', $CategoryIdApp); $ScriptIdAutomaticOff = IPS_GetScriptIDByName('IPSWatering_AutomaticOff', $CategoryIdApp); // Create Circles and Controls // ---------------------------------------------------------------------------------------------------------------------------- CreateProfile_Associations ('IPSWatering_Program', array( c_ProgramId_Manual => c_Program_Manual, c_ProgramId_EveryDay => c_Program_EveryDay, c_ProgramId_Every2Day => c_Program_Every2Day, c_ProgramId_Every3Day => c_Program_Every3Day, c_ProgramId_MonWedFri => c_Program_MonWedFri, c_ProgramId_MonTur => c_Program_MonTur, c_ProgramId_Sunday => c_Program_Sunday)); CreateProfile_Associations ('IPSWatering_Sensor', array( 0 => 'Aus', 1 => '1 mm', 2 => '2 mm',