示例#1
0
 if (IPS_GetVariable($Var)['VariableAction'] > 0) {
     // Standardaktion möglich
     if ($Mapping[$Obj['ObjectIdent']]['Action'] === true) {
         IPS_SetVariableCustomAction($Var, 0);
     } elseif ($Mapping[$Obj['ObjectIdent']]['Action'] === false) {
         IPS_SetVariableCustomAction($Var, 1);
     }
 } else {
     if ($Mapping[$Obj['ObjectIdent']]['Action'] === true) {
         echo "Gerät mit der Addresse " . (string) $Channel['Address'] . " hat keine Standardaktion," . PHP_EOL;
         echo "  für den Datenpunkt " . $Obj['ObjectIdent'] . " des Gerätes mit Namen '" . utf8_decode((string) $Channel['Name']) . "'." . PHP_EOL;
         echo "--------------------------------------------------------------------" . PHP_EOL;
     }
 }
 if (is_string($Mapping[$Obj['ObjectIdent']]['Action'])) {
     IPS_SetVariableCustomAction($Var, GetOrCreateScript($ScriptCat, $Mapping[$Obj['ObjectIdent']]['Action']));
 }
 $DeviceHidden = false;
 // Link erzeugen zu Gewerk wenn Mapping nicht leer ist
 if ($Mapping[$Obj['ObjectIdent']]['Name Gewerk'] == '') {
     continue;
 }
 //
 // Schleife Gewerk
 foreach ($Channel->{'Function'} as $Function) {
     $Name = sprintf($Mapping[$Obj['ObjectIdent']]['Name Gewerk'], utf8_decode((string) $Channel['Name']), utf8_decode((string) $Channel->Room[0]['Name']), utf8_decode((string) $Function['Name']));
     $LnkID = IPS_CreateLink();
     IPS_SetLinkTargetID($LnkID, $Var);
     IPS_SetName($LnkID, $Name);
     IPS_SetParent($LnkID, $Functions[utf8_decode((string) $Function['Name'])]);
 }
示例#2
0
<?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);
}