LAN-Adapter werden nicht alle gefunden

Hallo,

nach dem Umzug auf die CCU habe ich alle Scripte angepasst.

Bei den LAN-Adaptern ist mir aufgefallen das nur das Erste angezeigt wird.
Leider finde ich den Fehler nicht und weis nicht mehr von wem ich das Script kopiert hatte. :confused:


<?
if ($IPS_SENDER == "WebFront") return;

include IPS_GetKernelDir()."scripts\\xmlrpc.inc";

$client = new xmlrpc_client("192.168.115.50:2001"); // Adresse CCU

//Ab hier nichts mehr ändern
$object = IPS_GetObject($IPS_SELF);
$parentID = $object['ParentID'];

//Installer
if ($IPS_SENDER == "Execute")
{
  IPS_SetHidden($IPS_SELF, true);
  IPS_SetName($IPS_SELF, "Auswertung");
  $parentObject = IPS_GetObject($parentID);
  if ($parentObject['ObjectType'] !== 1)
  {
      $instanceID = IPS_CreateInstance("{485D0419-BE97-4548-AA9C-C083EB82E61E}");
      IPS_SetParent($instanceID, $parentID);
      $parentID = $instanceID;
      IPS_SetParent($IPS_SELF, $parentID);
      IPS_SetName($instanceID, "Homematic Interfaces");
  }
  IPS_SetScriptTimer($IPS_SELF, 900);
}

$abfrage = new xmlrpcmsg("listBidcosInterfaces");
$send = $client->send($abfrage);
$result = php_xmlrpc_decode($send->value());

for($i=0; $i <count($result); $i++)
{
    $adresse = CreateVariableByName($parentID, $result[$i]['DESCRIPTION'].": Adresse", 3);
    IPS_SetIcon($adresse, "Information");
    IPS_SetVariableCustomProfile($adresse, "~String");
    SetValue($adresse, $result[$i]['ADDRESS']);

    $connect = CreateVariableByName($parentID, $result[$i]['DESCRIPTION'].": Status", 0);
    if(!IPS_VariableProfileExists("Status"))
    {
        IPS_CreateVariableProfile("Status", 0);
        IPS_SetVariableProfileAssociation("Status", 1, "Online", "");
        IPS_SetVariableProfileAssociation("Status", 0, "Offline", "");
    }
    $action = IPS_GetVariable($connect);
    if($action['VariableCustomAction'] == 0)
    {
        IPS_SetVariableCustomAction($connect, $IPS_SELF);
        IPS_SetIcon($connect, "Information");
        IPS_SetVariableCustomProfile($connect, "Status");
    }
    SetValue($connect, $result[$i]['CONNECTED']);

   $default = CreateVariableByName($parentID, $result[$i]['DESCRIPTION'].": Default", 0);
    if(!IPS_VariableProfileExists("Default"))
    {
        IPS_CreateVariableProfile("Default", 0);
        IPS_SetVariableProfileAssociation("Default", 1, "Aktiv", "");
        IPS_SetVariableProfileAssociation("Default", 0, "Inaktiv", "");
    }
    $action = IPS_GetVariable($default);
    if($action['VariableCustomAction'] == 0)
    {
        IPS_SetVariableCustomAction($default, $IPS_SELF);
        IPS_SetIcon($default, "Information");
        IPS_SetVariableCustomProfile($default, "Default");
    }
    SetValue($default, $result[$i]['DEFAULT']);

}

function CreateVariableByName($id, $name, $type)
{
  global $IPS_SELF;
  $vid = @IPS_GetVariableIDByName($name, $id);
  if($vid === false)
  {
        $vid = IPS_CreateVariable($type);
      IPS_SetParent($vid, $id);
      IPS_SetName($vid, $name);
      IPS_SetInfo($vid, "this variable was created by script #$IPS_SELF");
  }
  return $vid;
}
?>

Im HM-Invertory von Andreas werden alle angezeigt.

Andreas

Wat so ne einfache Suche doch bringt :rolleyes:

Im weiteren Verlauf gibt es eine neue Version des Scripts (wenn ich es richtig verstanden habe).

Gruß
Bruno

Hallo Powerfreddy,

danke - hatte nach LAN-Adapter gesucht:rolleyes:

Andreas

Jetzt mal unter uns. Powerfreddy hat doch den Boardindex auswendig gelernt, so schnell wie er immer findet und uns den Weg zeigt.
:D:D:D

Im Ernst. Mein tiefer Respekt. Hihi

Hallo,

nö er kann`s auswendig :smiley:

Andreas

PS

Löst aber leider nicht mein Problem :smiley: