$Profile) { echo "Set VariableProfile='$Profile' for Variable='$Name' \n"; IPS_SetVariableCustomProfile($VariableId, $Profile); } if ($VariableData['VariableCustomAction'] <> $Action) { echo "Set VariableCustomAction='$Action' for Variable='$Name' \n"; IPS_SetVariableCustomAction($VariableId, $Action); } UpdateObjectData($VariableId, $Position, $Icon); return $VariableId; } function CreateCategory ($Name, $Parent, $Position, $Icon=null) { $CategoryId = @IPS_GetCategoryIDByName($Name, $Parent); if ($CategoryId === false) { $CategoryId = IPS_CreateCategory(); IPS_SetName($CategoryId, $Name); IPS_SetParent($CategoryId, $Parent); if ($Position!==false) { IPS_SetPosition($CategoryId, $Position); } if ($Icon!==false) { IPS_SetIcon($CategoryId, $Icon); } echo 'Created Category '.$Name.'='.$CategoryId."\n"; } UpdateObjectData($CategoryId, $Position, $Icon); return $CategoryId; } function UpdateObjectData($ObjectId, $Position, $Icon="") { $ObjectData = IPS_GetObject ($ObjectId); $ObjectPath = IPS_GetLocation($ObjectId); if ($ObjectData['ObjectPosition'] <> $Position and $Position!==false) { echo "Set ObjectPosition='$Position' for Object='$ObjectPath' \n"; IPS_SetPosition($ObjectId, $Position); } if ($ObjectData['ObjectIcon'] <> $Icon and $Icon!==false) { echo "Set ObjectIcon='$Icon' for Object='$ObjectPath' \n"; IPS_SetIcon($ObjectId, $Icon); } } function SendPlugwiseCommand($cmd, $REGVAR) { $ausgabe=dechex(calculate_common_crc16c($cmd)); $ausgabe = str_pad($ausgabe, 4 ,'0', STR_PAD_LEFT); //mit nullen auffüllen $cmd.= $ausgabe; // PRINT $cmd; RegVar_SendText($REGVAR,"\x05\x05\x03\x03".$cmd."\x0D\x0A"); Sleep(4); } ?>