<?
/*
* file PoK_Install.ips.php
* author Harald Hertlein
* version 1.0 22.06.14 14:11
* PC A5
*
* Dieses Skript legt IPS-Objekte für den Betrieb von Pokeys an
*/
// Ablauf in 6 Schritten:
// 1. PoKeys56E/PoKeys57E mit "PoKeys configuration software" von PoLabs (v3.0.65) konfigurieren
// 2. File -> Save -> [Dateiname eingeben und mit Pfad merken]
// 3. Pfad und Dateiname hier einkopieren:
$PoKeysConfigFile = 'D:\IPS_A5\PoKeys1.pkc';
// 4. Zusätzliche Angaben, die leider nicht von "PoKeys configuration software" abgespeichert werden, darin sichtbar über
$Device_Name = 'PoKeys1'; // 4.1 Device -> Change device name...
$User_Id = 2; // 4.2 Device -> Change User Id...
// 5.1 Ggf. individuelle Einstellungen ändern
$Poll = 800; // Aktualisierungzeit in ms
$strictVersion = 1; // bricht ab, wenn die von "PoKeys configuration software" gemeldete Version sich geändert hat
$OverrideIPS = 1; // löscht nicht mehr benötigte IPS-Objekte (wg. PoKeys-Umprogrammierung)
$MBAdr_Prefix = $Device_Name . " Pin "; // damit beginnen die Namen der angelegten ModBus Adressen
$MBVar_Prefix = "Wert von Pin "; // damit beginnen die Namen der angelegten ModBus Variablen
$Kategorie = 0; // ObjNr der PoKeys eigenen Kategorie (unterhalb der ModBus Adressen und -Variablen installiert werden), wenn nicht angegeben (=0), wird eine erstellt (als $Device_Name)
$MBProfile = ""; // Name des Profils der Modbus-Variablen. Wenn ein Leerstring übergeben wird, dann wird das Standard Profil für Boolean (~Switch) verwendet.
$Dallas = 0; // Anzahl der 1-Wire Temperaturfühler, für die Adressen angelegt werden sollen (ohne Gewähr, nicht getestet)
$EventSkript = 0; // ObjNr eines Skriptes, das bei Value-Änderungen der Modbus-Devices ausgeführt wird, wenn nicht angegeben, werden keine Events angelegt
// 5.2 ggf. verschiedene einmalige Durchläufe aktivieren
$ClearMode = 0; // 2=lösche alle Objekte die mit den unter 4. vorgenommenen Einstellungen eingetragen wurden (außer 1-wire), 1= beläßt Client Socket und Modbus RTU TCP
// 6. Dieses Script starten (Achtung: bereits händisch eingetragene Objekte werden ignoriert, es werden zusätzliche angelegt)
// ----------- Ab hier nichts mehr ändern -----------
// Identifizierungen für IPS_SetIdent:
function Ident() { // Prefix eines Identifierers für ['ObjectIdent']
global $Device_Name, $User_Id;
return $Device_Name . '_' . $User_Id . '_';
}
function PinIdent($Pin) { // Prefix eines Pin-Identifierers für ['ObjectIdent']
return Ident() . str_pad($Pin, 2, '0', STR_PAD_LEFT);
}
if ( $EventSkript ) {
if ( !(IPS_ScriptExists($EventSkript)) )
die("EventSkript nicht verfügbar !!");
}
// pin configuration [PinFunctions] lt. PoLabs
define("reserved1", 1); // 1
define("D_input", 2); // 2
define("D_output", 4); // 3
define("A_input", 8); // 4
define("A_output", 16); // 5
define("T_input", 32); // 6
define("reserved3", 64); // 7
define("Pin_invert", 128); // 8
function PinFunction($PF) {
$Text = '';
if ( $PF & reserved1 )
$Text .= ' reserved1';
if ( $PF & D_input )
$Text .= ' Digital input';
if ( $PF & D_output )
$Text .= ' Digital output';
if ( $PF & A_input )
$Text .= ' Analog input';
if ( $PF & T_input )
$Text .= ' Triggered input';
if ( $PF & reserved3 )
$Text .= ' reserved3';
if ( $PF & Pin_invert )
$Text .= ' (invert)';
return $Text;
}
// getestete Versionen
$VersionsListe = array ( 2 => 'v3.1.17' );
// Phase A: Lese und verarbeite PoKeys Config-File
$PoKeysC = json_decode(json_encode(simplexml_load_string(file_get_contents($PoKeysConfigFile))), true);
$version = $PoKeysC['version'];
if ( $strictVersion ) {
if ( !(isset($VersionsListe[$version])) )
die("Version $version noch nicht getestet !!");
}
$PinMax = $PoKeysC['pinNum'];
$IP = IPdecode(base64_decode($PoKeysC['curIPaddress']));
$Port = $PoKeysC['Modbus']['ModbusPort'];
$PinFunctions = base64_decode($PoKeysC['PinFunctions']);
unset($PoKeysC);
// Phase B: ggf. Client Socket und Modbus RTU TCP erstellen
// B.1 ggf. eigene Kategorie für "PoKeys" erstellen
if ( $Kategorie ) {
if ( !(IPS_CategoryExists($Kategorie)) )
die("Kategorie $Kategorie nicht gültig !!");
} else {
$Kategorie = CreateCategory($Device_Name, 0, 0);
}
// B.2 ggf. einen Splitter Modbus mit dem Namen z.B. "PoKeys1.1 Modbus RTU TCP" erstellen
$SplitterName = $Device_Name . '.' . $User_Id . ' Modbus RTU TCP';
$Splitter = CreateModbusRTUTCP($SplitterName, 0, 0, $Device_Name, $User_Id);
// B.3 ggf. den erstellten Client Socket mit dem Namen z.B. "PoKeys1.1 Client Socket" konfigurieren.
$SocketName = $Device_Name . '.' . $User_Id . ' Client Socket';
$ClientSocket = ConfigClientSocket($SocketName, 0, 0, $Splitter, $IP, $Port);
if ( $ClearMode == 2) {
IPS_DeleteInstance($ClientSocket);
IPS_DeleteInstance($Splitter);
} else {
echo "Client Socket $ClientSocket und ModBus Splitter $Splitter werden verwendet";
}
// Phase C: Gang durch die PoKeys configuration, Modbus Device anlegen und ggf. löschen
// C.1 erst mal ein Verzeichnis der bereits vorhandenen ModBus Adressen und ggf. Events anlegen
$ListeModBusAdressen = ListeModBusAdressen();
if ( $EventSkript ) // setze Event auf das Skript
$ListeEventZiele = ListeEventsAuf($EventSkript);
// C.2 ModBus Adressen anlegen
for ( $Pin = 1; $Pin <= $PinMax; $Pin++ ) {
// $Ausgabe = "Pin " . sprintf("%02s", $Pin);
if ( $ClearMode ) {
$PF = 0;
} else {
$PF = ord(substr($PinFunctions, $Pin - 1, 1)); // einzelne PinFunction von $Pin
}
if ( $PF ) {
echo("
Pin " . sprintf("%02s", $Pin));
echo(" = ");
$SetProperty = array ( /* IPS_SetProperty ModBus Address
Eigenschaft Typ Standardwert
WriteAddress integer 0
EmulateStatus boolean 1
ReadAddress integer 0
DataType integer 0
Poller integer 5000
ReadOnly boolean 0 */
'WriteAddress' => 0, // integer
'EmulateStatus' => 1, // boolean
'ReadAddress' => 0, // integer
'DataType' => 0, // integer 0=Bit, 1=Byte, 2=Word, 3=DWord, 4=ShortInt, 5=SmallInt, 6=Integer, 7=Real
'Poller' => $Poll, // integer
'ReadOnly' => 0, // boolean
'Pin' => $Pin,
'PinFunction' => $PF,
'Function' => 0, /* ModBus_SetType (Angabe in IP-S Dokumentation unter Modbus RTU/TCP als 'FunctionCode bei welcher Parameterierung innerhalb von IP-Symcon' (nicht nachvollziehbar, wird hier inhaltlich nicht benutzt)
FunctionCode Aktion Parameterierung in IP-Symcon
0x01 (1) Lesen Einheit = Bit
0x0F (15) Schreiben Einheit = Bit
0x03 (3) Lesen Einheit = Byte/Word/DWord/ShortInt/SmallInt/Integer/Float
0x10 (16) Schreiben Einheit = Byte/Word/DWord/ShortInt/SmallInt/Integer/Float
0x02 (2) Lesen Einheit = Bit, Nur-Lesen aktiviert
0x04 (4) Lesen Einheit = Byte/Word/DWord/ShortInt/SmallInt/Integer/Float, Nur-Lesen aktiviert
*/
);
echo(PinFunction($PF) . "
");
if ( $PF & reserved1 ) {
}
if ( $PF & D_input ) {
$SetProperty['ReadAddress'] = $Pin -1 ;
$SetProperty['ReadOnly'] = 1 ;
$SetProperty['DataType'] = 0 ; // integer 0=Bit
$SetProperty['Function'] = 2 ;
}
if ( $PF & D_output ) {
$SetProperty['WriteAddress'] = $Pin -1 ;
$SetProperty['DataType'] = 0 ; // integer 0=Bit
$SetProperty['Function'] = 15 ;
}
if ( $PF & A_input ){
$SetProperty['ReadAddress'] = $Pin -1 ;
$SetProperty['ReadOnly'] = 1 ;
$SetProperty['DataType'] = 3 ; // integer 3=DWord
$SetProperty['Function'] = 3 ;
}
if ( $PF & T_input ) {
}
if ( $PF & reserved3 ) {
}
if ( $PF & Pin_invert ) {
}
if ( $SetProperty['Function'] ) {
$PinName = $MBAdr_Prefix . str_pad($Pin, 2, '0', STR_PAD_LEFT) . PinFunction($PF);
$MBDevice = CreateModbusDevice($PinName, $Kategorie, $Pin, $Splitter, $SetProperty);
// C.3 ggf. die erstellte Variable konfigurieren.
$PinWertName = $MBVar_Prefix . str_pad($Pin, 2, '0', STR_PAD_LEFT);
$MBVariable = ConfigModbusVariable($PinWertName, 0, 0, $MBDevice, $MBProfile);
// C.4 ggf. Event erstellen.
if ( $EventSkript ) { // setze Event auf das Skript
$EvtName = $User_Id . '-' . str_pad($Pin, 2, '0', STR_PAD_LEFT);
if ( !(isset($ListeEventZiele[$MBVariable]) ) )
Def_Ereignis($EvtName, $MBVariable, $EventSkript);
}
}
} else { // nachprüfen ob schon was da ist
// C.2 ModBus Adressen löschen
$Ident = PinIdent($Pin);
if ( isset($ListeModBusAdressen[$Ident]) ) {
if ( $OverrideIPS ) {
if ( $EventSkript )
IPS_DeleteEvent($ListeEventZiele[$ListeModBusAdressen[$Ident]['ChildrenID']]['ObjectID']); // Event löschen
IPS_DeleteVariable($ListeModBusAdressen[$Ident]['ChildrenID']);
IPS_DeleteInstance($ListeModBusAdressen[$Ident]['ObjectID']);
echo("
Pin " . sprintf("%02s", $Pin));
echo(" wurde deaktiviert und $Ident gelöscht");
}
}
}
}
// D.1 1-Wire Temperaturfühler anlegen
if ( $Dallas ) {
$Dallas = min($Dallas, 27);
$DallasKat = CreateCategory('1-wire', $Kategorie, 100);
//Temperatur Pins erstellen (bis zu 27 Stück)
for ( $Pin = 0; $Pin < $Dallas; $Pin++ ) {
$SetProperty = array (
'WriteAddress' => 400 + ($Pin * 2), // integer
'EmulateStatus' => 1, // boolean
'ReadAddress' => 400 + ($Pin * 2), // integer
'DataType' => 3, // integer 0=Bit, 1=Byte, 2=Word, 3=DWord, 4=ShortInt, 5=SmallInt, 6=Integer, 7=Real
'Poller' => 1000, // integer
'ReadOnly' => 1, // boolean
'Pin' => $Pin,
'PinFunction' => A_input,
'Function' => 0,
);
$PinName = '#' . str_pad($Pin + 1, 3, '0', STR_PAD_LEFT) . PinFunction($PF);
$MBDevice = CreateModbusDevice($PinName, $DallasKat, $Pin, $Splitter, $SetProperty);
}
}
if ( $ClearMode ) {
} else {
//Client Socket aktivieren!
aktiviereClientSocket($ClientSocket);
}
//----------- E n d e -------------
//
//---- Funktionen
function IPdecode($IP) {
return ord(substr($IP, 0, 1)) . '.' . ord(substr($IP, 1, 1)) . '.' . ord(substr($IP, 2, 1)) . '.' . ord(substr($IP, 3, 1));
}
/** Quelle IPSInstaller: Anlegen einer Kategorie. */
function CreateCategory($Name, $ParentId, $Position, $Icon = null) {
$Id = @IPS_GetObjectIDByIdent(Get_IdentByName($Name), $ParentId);
if ( $Id === false )
$Id = @IPS_GetCategoryIDByName($Name, $ParentId);
if ( $Id === false ) {
$Id = IPS_CreateCategory();
IPS_SetName($Id, $Name);
IPS_SetIdent($Id, Get_IdentByName($Name));
if ( $ParentId !== false )
IPS_SetParent($Id, $ParentId);
if ( $Position !== false )
IPS_SetPosition($Id, $Position);
if ( $Icon !== false )
IPS_SetIcon($Id, $Icon);
IPS_SetInfo($Id, 'Kategorie erstellt von ' . $_IPS['SELF'] . ' (' . IPS_GetScriptFile($_IPS['SELF']) . ') am ' . strftime("%d.%m.%y %X", time()));
echo "IPS$Id " . IPS_GetLocation($Id) . " '$Name' als neue Category" . "
";
}
// UpdateObjectData($Id, $Position, $Icon);
return $Id;
}
/** Quelle IPSInstaller: Ident aus Namen generieren */
function Get_IdentByName($name) {
$ident = str_replace(' ', '', $name);
$ident = str_replace(array ( 'ö', 'ä', 'ü', 'Ö', 'Ä', 'Ü' ), array ( 'oe', 'ae', 'ue', 'Oe', 'Ae', 'Ue' ), $ident);
$ident = str_replace(array ( '"', '\'', '%', '&', '(', ')', '=', '#', '<', '>', '|', '\\' ), '', $ident);
$ident = str_replace(array ( ',', '.', ':', ';', '!', '?' ), '', $ident);
$ident = str_replace(array ( '+', '-', '/', '*' ), '', $ident);
return $ident;
}
/** Quelle IPSInstaller: Anlegen eines Events */
function CreateEvent($Name, $VariableId, $ScriptId, $TriggerType = 1/* ByChange */) {
$EventId = @IPS_GetObjectIDByIdent(Get_IdentByName($Name), $ScriptId);
if ($EventId === false)
$EventId = @IPS_GetEventIDByName($Name, $ScriptId);
if ($EventId === false) {
$EventId = IPS_CreateEvent(0);
IPS_SetName($EventId, $Name);
IPS_SetIdent($EventId, Get_IdentByName($Name));
IPS_SetEventTrigger($EventId, $TriggerType, $VariableId);
IPS_SetParent($EventId, $ScriptId);
IPS_SetEventActive($EventId, true);
// echo "Created Event $Name=$EventId, trigger ScriptId=$ScriptId by Variable=$VariableId
";
echo "IPS$EventId " . IPS_GetLocation($EventId) . " '$Name' als neuer Event" . "
";
}
return $EventId;
}
function aktiviereClientSocket($clientSocketId) {
IPS_SetProperty($clientSocketId, "Open", true);
IPS_ApplyChanges($clientSocketId);
}
// neue IPSInstall-Routinen
// Konfigurieren eines ClientSockets
function ConfigClientSocket($Name, $ParentId, $Position, $Splitter, $Host, $Port) {
$ModuleId = "{3CFF0FD9-E306-41DB-9B5A-9D06D38576C3}"; // ModuleName'=Client Socket
$Id = 0;
$Instance = IPS_GetInstance($Splitter);
$Id = $Instance['ConnectionID'];
IPS_SetName($Id, $Name);
if ( $ParentId !== false )
IPS_SetParent($Id, $ParentId);
if ( $Position !== false )
IPS_SetPosition($Id, $Position);
IPS_SetProperty($Id, "Host", $Host);
IPS_SetProperty($Id, "Port", $Port);
IPS_SetProperty($Id, "Open", false);
IPS_SetInfo($Id, 'ClientSocket erstellt von ' . $_IPS['SELF'] . ' (' . IPS_GetScriptFile($_IPS['SELF']) . ') am ' . strftime("%d.%m.%y %X", time()));
echo "I/O$Id /*" . IPS_GetLocation($Id) . "*/ als ClientSocket für $Splitter/*" . IPS_GetLocation($Splitter) . "*/ ($Host:$Port)" . "
";
IPS_ApplyChanges($Id);
return $Id;
}
// Anlegen eines ModBus-Splitters
function CreateModbusRTUTCP($Name, $ParentId, $Position, $Device_Name, $DeviceID = 1, $SwapWords = 1, $GatewayMode = 0) {
$ModuleId = "{A5F663AB-C400-4FE5-B207-4D67CC030564}"; // ModuleName'=ModBus RTU/TCP
$Ident = Ident();
$Id = 0;
$ObjectListe = IPS_GetObjectList();
foreach ( $ObjectListe as $Nr => $ObjectID ) {
$Objekt = IPS_GetObject($ObjectID);
if ( $Objekt['ObjectType'] == 1 ) { // Instanz
$Instance = IPS_GetInstance($ObjectID);
if ( $Instance['ModuleInfo']['ModuleID'] == $ModuleId ) {
if ( $Objekt['ObjectIdent'] == $Ident ) {
$Id = $ObjectID;
break;
}
}
}
}
if ( !($Id) ) {
$Id = IPS_CreateInstance($ModuleId); // ConnectInstance ist damit erstellt
IPS_SetName($Id, $Name);
IPS_SetIdent($Id, $Ident);
IPS_SetProperty($Id, "DeviceID", $DeviceID);
IPS_SetProperty($Id, "GatewayMode", $GatewayMode);
IPS_SetProperty($Id, "SwapWords", $SwapWords);
if ( $ParentId !== false )
IPS_SetParent($Id, $ParentId);
if ( $Position !== false )
IPS_SetPosition($Id, $Position);
IPS_SetInfo($Id, 'ModBus RTU/TCP erstellt von ' . $_IPS['SELF'] . ' (' . IPS_GetScriptFile($_IPS['SELF']) . ') am ' . strftime("%d.%m.%y %X", time()));
echo "S/I$Id /*" . IPS_GetLocation($Id) . "*/ als neuer ModBus RTU/TCP ($Ident)" . "
";
IPS_ApplyChanges($Id);
}
return $Id;
}
// Erstelle Liste mit allen ModbusDevices, auf die Ident() zutrifft, bestehend aus $Device_Name, $User_Id
function ListeModBusAdressen() {
$ModuleId = "{CB197E50-273D-4535-8C91-BB35273E3CA5}"; // ModuleName'=ModBus Address
$Ident = Ident();
$Liste = array ( );
$ObjectListe = IPS_GetObjectList();
foreach ( $ObjectListe as $Nr => $ObjectID ) {
$Objekt = IPS_GetObject($ObjectID);
if ( $Objekt['ObjectType'] == 1 ) { // Instanz
$Instance = IPS_GetInstance($ObjectID);
if ( $Instance['ModuleInfo']['ModuleID'] == $ModuleId ) {
if ( strpos($Objekt['ObjectIdent'], $Ident) === FALSE ) {
} else {
$Liste[substr($Objekt['ObjectIdent'], 0, strlen($Ident) + 2)] = array ( // 2 Stellen für Pin#
'ObjectID' => $Objekt['ObjectID'],
'ChildrenID' => $Objekt['ChildrenIDs'][0],
'ObjectIdent' => $Objekt['ObjectIdent'],
'ConnectionID' => $Instance['ConnectionID'],
'InstanceID' => $Instance['InstanceID'],
);
}
}
}
}
return $Liste;
}
// Erstelle Liste mit allen Events, die auf $EventSkript deuten
function ListeEventsAuf($EventSkript) {
$Liste = array ( );
$ObjectListe = IPS_GetObjectList();
foreach ( $ObjectListe as $Nr => $ObjectID ) {
$Objekt = IPS_GetObject($ObjectID);
if ( $Objekt['ObjectType'] == 4 ) { // 4: Ereignis
$Event = IPS_GetEvent($ObjectID);
if ( $Objekt['ParentID'] == $EventSkript ) {
if ( isset($Liste[$Event['TriggerVariableID']]) ) {
IPS_DeleteEvent($ObjectID); // Doppel löschen
} else {
$Liste[$Event['TriggerVariableID']] = array (
'ObjectID' => $Objekt['ObjectID'],
'Trigger' => $Event['TriggerVariableID'],
);
}
}
}
}
return $Liste;
}
// Anlegen oder Modifizieren eines ModBus-Devices
function CreateModbusDevice($Name, $ParentId, $Position, $InstanzId, $SetProperty ) {
$ModuleId = "{CB197E50-273D-4535-8C91-BB35273E3CA5}"; // ModuleName'=ModBus Address
$Ident = PinIdent($SetProperty['Pin']);
$Id = 0;
$ObjectListe = IPS_GetObjectList();
foreach ( $ObjectListe as $Nr => $ObjectID ) {
$Objekt = IPS_GetObject($ObjectID);
if ( $Objekt['ObjectType'] == 1 ) { // Instanz
$Instance = IPS_GetInstance($ObjectID);
if ( $Instance['ModuleInfo']['ModuleID'] == $ModuleId ) {
if ( strpos($Objekt['ObjectIdent'], $Ident) === FALSE ) {
} else {
$Id = $ObjectID;
break;
}
}
}
}
if ( $Id ) { // ggf. Änderungen eintragen
$Objekt = IPS_GetObject($Id);
$PF = substr($Objekt['ObjectIdent'], strlen($Ident . '_'));
if ( $PF == $SetProperty['PinFunction'] ) {
return $Id;
} else {
IPS_SetInfo($Id, 'ModBus Device geändert von ' . $_IPS['SELF'] . ' (' . IPS_GetScriptFile($_IPS['SELF']) . ') am ' . strftime("%d.%m.%y %X", time()));
echo "IPS$Id /*" . IPS_GetLocation($Id) . "*/ Änderung eines Modbus Devices [" . $SetProperty['PinFunction'] . "] auf $InstanzId" . "
";
}
} else { // neu anlegen
$Id = IPS_CreateInstance($ModuleId);
IPS_SetName($Id, $Name);
if ( $ParentId )
IPS_SetParent($Id, $ParentId);
if ( $Position )
IPS_SetPosition($Id, $Position);
IPS_SetInfo($Id, 'ModBus Device erstellt von ' . $_IPS['SELF'] . ' (' . IPS_GetScriptFile($_IPS['SELF']) . ') am ' . strftime("%d.%m.%y %X", time()));
echo "IPS$Id /*" . IPS_GetLocation($Id) . "*/ als neues Modbus Device [" . $SetProperty['PinFunction'] . "] auf $InstanzId" . "
";
IPS_ApplyChanges($Id);
}
IPS_SetIdent($Id, $Ident . '_' . $SetProperty['PinFunction']); // zusätzlich 'PinFunction'
ModBus_SetType($Id, $SetProperty['DataType']);
ModBus_SetWriteAddress($Id, $SetProperty['WriteAddress']);
ModBus_SetReadAddress($Id, $SetProperty['ReadAddress']);
ModBus_SetPoller($Id, $SetProperty['Poller']);
ModBus_SetReadOnly($Id, $SetProperty['ReadOnly']);
IPS_DisconnectInstance($Id); // falls sich was eingenistet hat.
IPS_ConnectInstance($Id, $InstanzId);
IPS_ApplyChanges($Id);
return $Id;
}
// Konfigurieren einer Modbus-Variablen
function ConfigModbusVariable($Name, $ParentId, $Position, $MBDevice, $Profile = "") {
$Id = 0;
$Objekt = IPS_GetObject($MBDevice);
if ( isset($Objekt['ChildrenIDs'][0]) ) {
$Id = $Objekt['ChildrenIDs'][0];
IPS_SetName($Id, $Name);
IPS_SetParent($Id, $MBDevice);
if ( $Profile )
IPS_SetVariableCustomProfile($Id, $Profile);
if ( $ParentId )
IPS_SetParent($Id, $ParentId);
if ( $Position )
IPS_SetPosition($Id, $Position);
IPS_SetInfo($Id, 'ModBus Variable erstellt von ' . $_IPS['SELF'] . ' (' . IPS_GetScriptFile($_IPS['SELF']) . ') am ' . strftime("%d.%m.%y %X", time()));
echo "IPS$Id /*" . IPS_GetLocation($Id) . "*/ als Variable für $MBDevice/*" . IPS_GetLocation($MBDevice) . "*/ " . "
";
return $Id;
} else {
return $Id;
}
}
// Erzeuge einen Event
function Def_Ereignis($Name, $VariableId, $ScriptId, $Trigger = 1) { // universelle Routine
$Id = (CreateEvent($Name, $VariableId, $ScriptId, 1));
IPS_SetInfo($Id, 'Ereignis erstellt von ' . $_IPS['SELF'] . ' (' . IPS_GetScriptFile($_IPS['SELF']) . ') am ' . strftime("%d.%m.%y %X", time()));
return $Id;
}
?>