当前位置: 首页>>代码示例>>PHP>>正文


PHP IPS_SetProperty函数代码示例

本文整理汇总了PHP中IPS_SetProperty函数的典型用法代码示例。如果您正苦于以下问题:PHP IPS_SetProperty函数的具体用法?PHP IPS_SetProperty怎么用?PHP IPS_SetProperty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IPS_SetProperty函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ApplyChanges

 public function ApplyChanges()
 {
     //Never delete this line!
     parent::ApplyChanges();
     $change = false;
     // Zwangskonfiguration des ClientSocket
     $ParentID = $this->GetParent();
     if (!($ParentID === false)) {
         if (IPS_GetProperty($ParentID, 'Host') != $this->ReadPropertyString('Host')) {
             IPS_SetProperty($ParentID, 'Host', $this->ReadPropertyString('Host'));
             $change = true;
         }
         if (IPS_GetProperty($ParentID, 'Port') != $this->ReadPropertyInteger('Port')) {
             IPS_SetProperty($ParentID, 'Port', $this->ReadPropertyInteger('Port'));
             $change = true;
         }
         $ParentOpen = $this->ReadPropertyBoolean('Open');
         // Keine Verbindung erzwingen wenn Host leer ist, sonst folgt später Exception.
         if (IPS_GetProperty($ParentID, 'Open') != $ParentOpen) {
             IPS_SetProperty($ParentID, 'Open', $ParentOpen);
             $change = true;
         }
         if ($change) {
             @IPS_ApplyChanges($ParentID);
         }
     }
     /* Eigene Profile
      */
     //Workaround für persistente Daten der Instanz
     // Wenn wir verbunden sind, am Gateway mit listen anmelden für Events
     if ($this->ReadPropertyBoolean('Open') and $this->HasActiveParent($ParentID)) {
         $this->SetStatus(102);
     }
 }
开发者ID:hermanthegerman2,项目名称:Logamatic4000,代码行数:34,代码来源:module.php

示例2: Create

 public function Create()
 {
     parent::Create();
     IPS_SetProperty($this->InstanceID, 'Port', 1400);
     IPS_SetProperty($this->InstanceID, 'ConnectionType', 'curl');
     IPS_SetProperty($this->InstanceID, 'Timeout', 2);
     $this->RegisterPropertyInteger('IntervallRefresh', 60);
     $this->RegisterTimer('Refresh_All', 0, 'rpc2sonos_Update($_IPS[\'TARGET\']);');
 }
开发者ID:TierFreund,项目名称:Rpc2Symcon,代码行数:9,代码来源:module.php

示例3: ApplyChanges

 public function ApplyChanges()
 {
     //Never delete this line!
     parent::ApplyChanges();
     if (trim($this->ReadPropertyString('Apikey')) == "") {
         $this->SetStatus(104);
     } else {
         $this->SetStatus(102);
     }
     if (trim($this->ReadPropertyString('Apikey')) != $this->ReadPropertyString('Apikey')) {
         @IPS_SetProperty($this->InstanceID, 'Apikey', trim($this->ReadPropertyString('Apikey')));
         @IPS_ApplyChanges($this->InstanceID);
     }
 }
开发者ID:Nall-chan,项目名称:IPSVoiceRSS,代码行数:14,代码来源:module.php

示例4: RegisterHook

 private function RegisterHook($Hook, $TargetID)
 {
     $ids = IPS_GetInstanceListByModuleID("{015A6EB8-D6E5-4B93-B496-0D3F77AE9FE1}");
     if (sizeof($ids) > 0) {
         $hooks = json_decode(IPS_GetProperty($ids[0], "Hooks"), true);
         $found = false;
         foreach ($hooks as $index => $hook) {
             if ($hook['Hook'] == "/hook/locative") {
                 if ($hook['TargetID'] == $TargetID) {
                     return;
                 }
                 $hooks[$index]['TargetID'] = $TargetID;
                 $found = true;
             }
         }
         if (!$found) {
             $hooks[] = array("Hook" => "/hook/locative", "TargetID" => $TargetID);
         }
         IPS_SetProperty($ids[0], "Hooks", json_encode($hooks));
         IPS_ApplyChanges($ids[0]);
     }
 }
开发者ID:mcbeyel,项目名称:IPSLocative,代码行数:22,代码来源:module.php

示例5: SetProperty

 protected function SetProperty($ident, $value)
 {
     IPS_SetProperty($this->InstanceID, $ident, $value);
     IPS_LogMessage(get_class($this), "SetProperty({$ident},{$value})");
 }
开发者ID:TierFreund,项目名称:Ips2rpc,代码行数:5,代码来源:RpcModule.class.php

示例6: AddAddress

 protected function AddAddress(string $address)
 {
     $instance = IPS_GetInstance($this->InstanceID)["InstanceID"];
     IPS_SetProperty($instance, "LEDAdresse", $address);
     //Adresse setzten.
     IPS_SetProperty($instance, "LearnAddressLED", false);
     //Haken entfernen.
     IPS_ApplyChanges($instance);
     //Neue Konfiguration übernehmen
     IPS_LogMessage("LED Controller Adresse hinzugefügt:", $address);
 }
开发者ID:Wolbolar,项目名称:IPSymconAIOGateway,代码行数:11,代码来源:module.php

示例7: ProcessAbsence

 public function ProcessAbsence()
 {
     $groups = $this->ReadPropertyInteger("Groups");
     if ($groups == 0) {
         return;
     }
     $currentGroup = $this->ReadPropertyInteger("CurrentGroup");
     $groupID = IPS_GetObjectIDByIdent("group_" . $currentGroup, $this->InstanceID);
     $speed = Max(1, $this->ReadPropertyInteger("Speed"));
     $random = $this->ReadPropertyInteger("Random");
     IPS_LogMessage("Absence", "Processing Group {$currentGroup} with ID {$groupID}");
     $delayVariable = IPS_GetObjectIDByIdent("delay_group_" . $currentGroup, $groupID);
     $stateVariable = IPS_GetObjectIDByIdent("state_group_" . $currentGroup, $groupID);
     $childVariable = IPS_GetObjectIDByIdent("childs_group_" . $currentGroup, $groupID);
     $state = GetValue($stateVariable);
     $this->processChilds($childVariable, $state);
     /** Recalculate the next event time*/
     $random_delay = rand(-1 * $random, 1 * $random);
     $delay = Max(1000, (GetValue($delayVariable) + $random_delay) * 1000 / $speed);
     $this->SetTimerInterval("AbsenceTimer", $delay);
     $currentGroup = ($currentGroup + 1) % $groups;
     IPS_SetProperty($this->InstanceID, "CurrentGroup", $currentGroup);
 }
开发者ID:mcbeyel,项目名称:IPSAbsence,代码行数:23,代码来源:module.php

示例8: CreateENDevice

 /**
  * Create a new EnergyDev instance and set its properties
  * @param array $data parsed record
  * @param String $caps String semicolon seperated capabilities of this device
  * @return int new Instance ID
  */
 private function CreateENDevice($data, $caps)
 {
     $instID = 0;
     $Device = $data['Id'];
     $typ = $data['Typ'];
     $ModuleID = $this->module_interfaces['EnergyDev'];
     if (IPS_ModuleExists($ModuleID)) {
         //return $result;
         $this->debug(__FUNCTION__, "Create Device {$Device},Type {$typ}");
         $instID = IPS_CreateInstance($ModuleID);
         if ($instID > 0) {
             IPS_ConnectInstance($instID, $this->InstanceID);
             //Parents are ourself!
             IPS_SetProperty($instID, 'DeviceID', $Device);
             IPS_SetProperty($instID, 'Class', __CLASS__);
             IPS_SetProperty($instID, 'Typ', $typ);
             IPS_SetProperty($instID, 'CapList', $caps);
             IPS_SetProperty($instID, 'Debug', $this->isDebug());
             //follow debug settings from splitter
             IPS_SetName($instID, "{$typ} ID {$Device}");
             $ident = __CLASS__ . "_EN_{$Device}";
             $ident = preg_replace("/\\W/", "_", $ident);
             //nicht-Buchstaben/zahlen entfernen
             IPS_SetIdent($instID, $ident);
             IPS_ApplyChanges($instID);
             $cat = $this->GetCategory();
             $pcat = $this->GetParentCategory();
             $ident = preg_replace("/\\W/", "_", $cat);
             //nicht-Buchstaben/zahlen entfernen
             $catid = @IPS_GetObjectIDByIdent($ident, $pcat);
             if ($catid == 0) {
                 $catid = IPS_CreateCategory();
                 IPS_SetName($catid, $cat);
                 if (IPS_SetIdent($catid, $ident) && IPS_SetParent($catid, $pcat)) {
                     IPS_LogMessage(__CLASS__, "Category {$cat} Ident {$ident} ({$catid}) created");
                 } else {
                     IPS_LogMessage(__CLASS__, "Category {$cat} Ident {$ident} ({$catid}) FAILED");
                 }
             }
             $this->debug(__FUNCTION__, "Category:{$catid}");
             if (!IPS_SetParent($instID, $catid)) {
                 $this->debug(__FUNCTION__, "SetParent to Cat {$catid} failed");
             }
             $this->debug(__FUNCTION__, 'New ID:' . $instID);
             //if instID
         } else {
             $this->debug(__FUNCTION__, 'Instance  is not created!');
         }
     }
     //module exists
     return $instID;
 }
开发者ID:Tommi2Day,项目名称:ipsymcon-phpmodule-by-Tommi,代码行数:58,代码来源:module.php

示例9: AddIRCode

 protected function AddIRCode($ircode, $irid)
 {
     $code = "IRCode" . $irid;
     $label = "IRLabel" . $irid;
     //$instance = IPS_GetInstance($this->InstanceID)["InstanceID"];
     IPS_SetProperty($this->InstanceID, $code, $ircode);
     //IRCode setzten.
     $IRLabel = $this->ReadPropertyString($label);
     if (empty($IRLabel)) {
         IPS_SetProperty($this->InstanceID, $label, "Neuer Code");
         //IRLabel provisorisch setzten.
     }
     $NumberIRCodes = $this->ReadPropertyString("NumberIRCodes");
     $NumberIRCodes = $NumberIRCodes + 1;
     $this->CreateProfileIR($NumberIRCodes);
     IPS_SetProperty($this->InstanceID, "NumberIRCodes", $NumberIRCodes);
     //IRCode setzten.
     IPS_SetProperty($this->InstanceID, "LearnIRCode", false);
     //Haken entfernen.
     IPS_ApplyChanges($this->InstanceID);
     //Neue Konfiguration übernehmen
     IPS_LogMessage("IRCode" . $irid . " hinzugefügt:", $ircode);
     // Status aktiv
     $this->SetStatus(102);
 }
开发者ID:Wolbolar,项目名称:IPSymconAIOGateway,代码行数:25,代码来源:module.php

示例10: SyncDevices

  public function SyncDevices() {
    $lightsCategoryId = $this->GetLightsCategory();

    $lights = $this->Request('/lights');
    foreach ($lights as $lightId => $light) {
      $name = utf8_decode((string)$light->name);
      $uniqueId = (string)$light->uniqueid;
      echo "$lightId. $name ($uniqueId)\n";

      $deviceId = $this->GetDeviceByUniqueId($uniqueId);

      if ($deviceId == 0) {
        $deviceId = IPS_CreateInstance($this->DeviceGuid());
        IPS_SetProperty($deviceId, 'UniqueId', $uniqueId);
      }

      IPS_SetParent($deviceId, $lightsCategoryId);
      IPS_SetProperty($deviceId, 'LightId', (integer)$lightId);
      IPS_SetName($deviceId, $name);

      // Verbinde Light mit Bridge
      if (IPS_GetInstance($deviceId)['ConnectionID'] <> $this->InstanceID) {
        @IPS_DisconnectInstance($deviceId);
        IPS_ConnectInstance($deviceId, $this->InstanceID);
      }

      IPS_ApplyChanges($deviceId);
      HUE_RequestData($deviceId);
    }
  }
开发者ID:Vansdan,项目名称:SymconHUE,代码行数:30,代码来源:module.php

示例11: ApplyData

  public function ApplyData($data) {
    $data = (array)$data;
    $state = (array)$data['state'];

    /*
     * Properties
     */

    $dirty = false;

    $modelid = utf8_decode((string)$data['modelid']);
    $type = utf8_decode((string)$data['type']);
    $name = utf8_decode((string)$data['name']);
    if (IPS_GetProperty($this->InstanceID, 'ModelId') != $modelid) {
      IPS_SetProperty($this->InstanceID, 'ModelId', $modelid);
      $dirty = true;
    }
    if (IPS_GetProperty($this->InstanceID, 'Type') != $type) {
      IPS_SetProperty($this->InstanceID, 'Type', $type);
      $dirty = true;
    }
    if (IPS_GetName($this->InstanceID) != $name) {
      IPS_SetName($this->InstanceID, $name);
      $dirty = true;
    }

    // Setze den Modus
    if (isset($state['ct']) && isset($state['hue'])) {
      // HUE+CT Lamp
      $lightFeature = 0;
    } elseif(isset($state['hue'])) {
      // HUE Lamp
      $lightFeature = 1;
    } elseif(isset($state['ct'])) {
      // CT Lamp
      $lightFeature = 2;
    } else {
      // Lux Lamp
      $lightFeature = 3;
    }

    if (IPS_GetProperty($this->InstanceID, 'LightFeatures') != $lightFeature) {
      IPS_SetProperty($this->InstanceID, 'LightFeatures', $lightFeature);
      $dirty = true;
    }

    if ($dirty) IPS_ApplyChanges($this->InstanceID);

    /*
     * Variables
     */

    $stateId = $this->RegisterVariableBoolean("STATE", "Zustand", "~Switch");
    $this->EnableAction("STATE");
    IPS_SetPosition($stateId, 1);

    $cmId = $this->RegisterVariableInteger("COLOR_MODE", "Modus", "ColorModeSelect.Hue");
    $this->EnableAction("COLOR_MODE");
    IPS_SetPosition($cmId, 2);
    IPS_SetIcon($cmId, 'ArrowRight');

    $briId = $this->RegisterVariableInteger("BRIGHTNESS", "Helligkeit", "~Intensity.100");
    $this->EnableAction("BRIGHTNESS");
    IPS_SetIcon($briId, 'Sun');
    IPS_SetPosition($briId, 5);

    if ($lightFeature == 0 || $lightFeature == 1) {
      $hueId = $this->RegisterVariableInteger("HUE", "Hue");
      IPS_SetHidden($hueId, true);
    } else {
      $delete = @IPS_GetObjectIDByIdent("HUE", $this->InstanceID);
      if ($delete !== false) IPS_DeleteVariable($delete);
    }

    if ($lightFeature == 0) {
      IPS_SetVariableCustomProfile($cmId, 'ColorModeSelect.Hue');
      IPS_SetHidden($cmId, false);
    } else {
      IPS_SetHidden($cmId, true);
    }

    if ($lightFeature == 0 || $lightFeature == 2) {
      $ctId = $this->RegisterVariableInteger("COLOR_TEMPERATURE", "Farbtemperatur", "~Intensity.100");
      $this->EnableAction("COLOR_TEMPERATURE");
      IPS_SetIcon($ctId, 'Bulb');
      IPS_SetPosition($ctId, 4);
    } else {
      $delete = @IPS_GetObjectIDByIdent("COLOR_TEMPERATURE", $this->InstanceID);
      if ($delete !== false) IPS_DeleteVariable($delete);
    }

    if ($lightFeature == 0 || $lightFeature == 1) {
      $colorId = $this->RegisterVariableInteger("COLOR", "Farbe", "~HexColor");
      $this->EnableAction("COLOR");
      IPS_SetPosition($colorId, 3);
      IPS_SetIcon($colorId, 'Bulb');

      $satId = $this->RegisterVariableInteger("SATURATION", utf8_decode("Sättigung"), "~Intensity.100");
      $this->EnableAction("SATURATION");
      IPS_SetIcon($satId, 'Intensity');
//.........这里部分代码省略.........
开发者ID:Vansdan,项目名称:SymconHUE,代码行数:101,代码来源:module.php

示例12: GenerateShutter

		/**
		* This function will be available automatically after the module is imported with the module control.
		* Using the custom prefix this function will be callable from PHP and JSON-RPC through:
		*
		* LJ_GenerateShutter($id, $Start, $End);
		*
		*/
		public function GenerateShutter($Start, $End)
		{
			
			$qid = @IPS_GetObjectIDByIdent("KNXQuick", 0);
			if($qid === false) {
				$qid = IPS_CreateCategory();
				IPS_SetName($qid, "KNX quick");
				IPS_SetIdent($qid, "KNXQuick");
			}
			
			$sid = @IPS_GetObjectIDByIdent("Shutter", $qid);
			if($sid === false) {
				$sid = IPS_CreateCategory();
				IPS_SetName($sid, "Shutter");
				IPS_SetIdent($sid, "Shutter");
				IPS_SetParent($sid, $qid);
				IPS_SetPosition($sid, 2);
			}
			
			for($i=$Start; $i<=$End; $i++) {
				for($j=0; $j<=9; $j++) {
					$iid = @IPS_GetObjectIDByIdent("Shutter".strtoupper(dechex($i).$j), $sid);
					if($iid === false) {
						$iid = IPS_CreateInstance("{24A9D68D-7B98-4D74-9BAE-3645D435A9EF}");
						IPS_SetName($iid, "Shutter (Group ".strtoupper(dechex($i)).", Channel ".$j.")");
						IPS_SetIdent($iid, "Shutter".strtoupper(dechex($i)).$j);
						IPS_SetParent($iid, $sid);
						IPS_SetProperty($iid, "GroupMoveAddress1", 14);
						IPS_SetProperty($iid, "GroupMoveAddress2", 0);
						IPS_SetProperty($iid, "GroupMoveAddress3", ($i*16)+$j);
						IPS_SetProperty($iid, "GroupStopAddress1", 14);
						IPS_SetProperty($iid, "GroupStopAddress2", 1);
						IPS_SetProperty($iid, "GroupStopAddress3", ($i*16)+$j);
						if($j > 0) {
							$mapping = Array();
							$mapping[] = Array(
								"GroupAddress1" => 14,
								"GroupAddress2" => 0,
								"GroupAddress3" => $i*16
							);
							$mapping[] = Array(
								"GroupAddress1" => 14,
								"GroupAddress2" => 0,
								"GroupAddress3" => 240
							);
							$mapping[] = Array(
								"GroupAddress1" => 14,
								"GroupAddress2" => 0,
								"GroupAddress3" => 240+$j
							);
							IPS_SetProperty($iid, "GroupMoveMapping", json_encode($mapping));
							$mapping = Array();
							$mapping[] = Array(
								"GroupAddress1" => 14,
								"GroupAddress2" => 1,
								"GroupAddress3" => $i*16
							);
							$mapping[] = Array(
								"GroupAddress1" => 14,
								"GroupAddress2" => 1,
								"GroupAddress3" => 240
							);
							$mapping[] = Array(
								"GroupAddress1" => 14,
								"GroupAddress2" => 1,
								"GroupAddress3" => 240+$j
							);
							IPS_SetProperty($iid, "GroupStopMapping", json_encode($mapping));
						}
						IPS_ApplyChanges($iid);
					}
				}
			}
			
			echo "Done.";
			
		}		
开发者ID:symcon,项目名称:SymconLJ,代码行数:84,代码来源:module.php

示例13: StartTimer

 /**
  * Startet den Timer bis zum Alarm
  *
  * @access private
  */
 private function StartTimer()
 {
     if (IPS_GetKernelRunlevel() != KR_READY) {
         return;
     }
     $NowTime = time();
     if (!IPS_VariableExists($this->ReadPropertyInteger('VarID'))) {
         IPS_SetProperty($this->InstanceID, 'VarID', 0);
         IPS_ApplyChanges($this->InstanceID);
         return;
     }
     $Variable = IPS_GetVariable($this->ReadPropertyInteger('VarID'));
     $LastTime = $Variable['VariableUpdated'];
     $TargetTime = $LastTime + $this->ReadPropertyInteger('Timer');
     $DiffTime = $TargetTime - $NowTime;
     if ($TargetTime < $NowTime) {
         $this->SetStateVar(true);
         $this->DoScript($this->ReadPropertyInteger('VarID'), true, $this->State);
         $this->State = true;
         if ($this->ReadPropertyBoolean('MultipleAlert') == false) {
             $this->StopTimer();
         } else {
             $this->SetTimerInterval('NoTrigger', $this->ReadPropertyInteger('Timer') * 1000);
         }
         // neuer Timer mit max. Zeit, ohne now zu berücksichtigen.
     } else {
         $this->SetStateVar(false);
         if ($this->State) {
             $this->DoScript($this->ReadPropertyInteger('VarID'), false, $this->State);
             $this->State = false;
         }
         $this->SetTimerInterval('NoTrigger', $DiffTime * 1000);
     }
 }
开发者ID:Nall-chan,项目名称:IPSNoTrigger,代码行数:39,代码来源:module.php

示例14: CreateEnergyDevice

 /**
  * Create a new EnergyDev instance and set its properties
  * @param array $data parsed record
  * @param String $caps String semicolon seperated capabilities of this device
  * @return int new Instance ID
  */
 private function CreateEnergyDevice($data, $caps)
 {
     $instID = 0;
     $Device = $data['Id'];
     $typ = $data['Typ'];
     $name = $data['Name'];
     $branch = $data['Branch'];
     unset($data['Branch']);
     if (!$name) {
         $name = "XS1 {$branch} {$Device}";
     }
     $class = __CLASS__ . "-EN";
     //$host = $this->GetHost();
     $ModuleID = $this->module_interfaces['EnergyDev'];
     if (IPS_ModuleExists($ModuleID)) {
         //return $result;
         $this->debug(__FUNCTION__, 'Device:' . $Device);
         $instID = IPS_CreateInstance($ModuleID);
         if ($instID > 0) {
             IPS_SetProperty($instID, 'DeviceID', $Device);
             IPS_SetProperty($instID, 'Class', $class);
             IPS_SetProperty($instID, 'Typ', $typ);
             IPS_SetProperty($instID, 'CapList', $caps);
             IPS_SetProperty($instID, 'Debug', $this->isDebug());
             //follow debug settings from splitter
             IPS_SetName($instID, "XS1 {$branch} '{$name}'");
             $ident = $class . "_" . $branch . "_{$Device}";
             $ident = preg_replace("/\\W/", "_", $ident);
             //nicht-Buchstaben/zahlen entfernen
             IPS_SetIdent($instID, $ident);
             IPS_ConnectInstance($instID, $this->InstanceID);
             IPS_ApplyChanges($instID);
             //set category
             $cat = $this->GetCategory() . " {$branch}" . "s";
             $pcat = $this->GetParentCategory();
             $ident = preg_replace("/\\W/", "_", $cat);
             //fix naming
             $catid = @IPS_GetObjectIDByIdent($ident, $pcat);
             if ($catid == 0) {
                 $catid = IPS_CreateCategory();
                 IPS_SetName($catid, $cat);
                 if (IPS_SetIdent($catid, $ident) && IPS_SetParent($catid, $pcat)) {
                     IPS_LogMessage($class, "Category {$cat} Ident {$ident} ({$catid}) created");
                 } else {
                     IPS_LogMessage($class, "Category {$cat} Ident {$ident} ({$catid}) FAILED");
                 }
             }
             $this->debug(__FUNCTION__, "Category:{$catid}");
             if (!IPS_SetParent($instID, $catid)) {
                 $this->debug(__FUNCTION__, "SetParent Instance {$instID} to Cat {$catid} failed, Dropping instance");
                 IPS_DeleteInstance($instID);
                 $instID = 0;
             } else {
                 $this->debug(__FUNCTION__, 'New ID:' . $instID);
             }
             //if instID
         } else {
             $this->debug(__FUNCTION__, 'Instance  is not created!');
         }
     }
     //module exists
     return $instID;
 }
开发者ID:Tommi2Day,项目名称:ipsymcon-phpmodule-by-Tommi,代码行数:69,代码来源:module.php

示例15: CreateWSDevice

 /**
  * Create a new WSDev instance and set its properties
  * @param array $data parsed record
  * @param String $caps String semicolon seperated capabilities of this device
  * @return int new Instance ID
  */
 private function CreateWSDevice($data, $caps)
 {
     $instID = 0;
     $Device = $data['Id'];
     $typ = $data['Typ'];
     $ModuleID = $this->module_interfaces['WSDEV'];
     if (IPS_ModuleExists($ModuleID)) {
         //return $result;
         $this->debug(__FUNCTION__, "Create Device {$Device},Type {$typ}");
         $instID = IPS_CreateInstance($ModuleID);
         if ($instID > 0) {
             IPS_ConnectInstance($instID, $this->InstanceID);
             //Parents are ourself!
             IPS_SetProperty($instID, 'DeviceID', $Device);
             IPS_SetProperty($instID, 'Class', __CLASS__);
             IPS_SetProperty($instID, 'Typ', $typ);
             IPS_SetProperty($instID, 'CapList', $caps);
             IPS_SetProperty($instID, 'Debug', $this->isDebug());
             //follow debug settings from splitter
             switch ($Device) {
                 case 0:
                 case $Device < 8:
                     IPS_SetName($instID, 'Sensor ' . $Device);
                     break;
                 case 8:
                     IPS_SetName($instID, 'KombiSensor');
                     break;
                 case 9:
                     IPS_SetName($instID, 'InnenSensor');
                     break;
                 default:
                     IPS_SetName($instID, "unknown Sensor('" . strToHex($Device) . "')");
                     break;
             }
             //switch
             $ident = __CLASS__ . "_WS_{$Device}";
             $ident = preg_replace("/\\W/", "_", $ident);
             //nicht-Buchstaben/zahlen entfernen
             IPS_SetIdent($instID, $ident);
             IPS_ApplyChanges($instID);
             $cat = $this->GetCategory();
             $pcat = $this->GetParentCategory();
             $ident = preg_replace("/\\W/", "_", $cat);
             //nicht-Buchstaben/zahlen entfernen
             $catid = @IPS_GetObjectIDByIdent($ident, $pcat);
             if ($catid == 0) {
                 $catid = IPS_CreateCategory();
                 IPS_SetName($catid, $cat);
                 if (IPS_SetIdent($catid, $ident) && IPS_SetParent($catid, $pcat)) {
                     IPS_LogMessage(__CLASS__, "Category {$cat} Ident {$ident} ({$catid}) created");
                 } else {
                     IPS_LogMessage(__CLASS__, "Category {$cat} Ident {$ident} ({$catid}) FAILED");
                 }
             }
             $this->debug(__FUNCTION__, "Category:{$catid}");
             if (!IPS_SetParent($instID, $catid)) {
                 $this->debug(__FUNCTION__, "SetParent to Cat {$catid} failed");
             }
             $this->debug(__FUNCTION__, 'New ID:' . $instID);
             //if instID
             //set willi profile for forecast
             $vid = @IPS_GetObjectIDByIdent('Forecast', $instID);
             if ($vid > 0) {
                 IPS_SetVariableCustomProfile($vid, "WS300_Willi");
             }
         } else {
             $this->debug(__FUNCTION__, 'Instance  is not created!');
         }
     }
     //module exists
     return $instID;
 }
开发者ID:Tommi2Day,项目名称:ipsymcon-phpmodule-by-Tommi,代码行数:78,代码来源:module.php


注:本文中的IPS_SetProperty函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。