Übersicht KNX Adresse / Rückmeldeadresse

Vielen Dank Michael, das Script funktioniert in weiten Teilen wie gewünscht.

Falls es für euer anderes Projekt relevant ist: Ein kleiner Fehler ist mir aufgefallen, der bei meinen Shutter-Instanzen auftritt. Schritt/Lamelle ist dort abgeschaltet und darüber stolpert dein Script.

Die hörenden Adressen dieser Instanz (0/0/80 für Fahren und 3/2/24 für absolute Position) werden offenbar auch nicht ausgegeben.

16740,Küchentür,KNX\Jalousie\Küchentür,3/2/21
Notice: Undefined index: GroupMoveAddress1 in C:\ProgramData\Symcon\scripts\12070.ips.php on line 48

Notice: Undefined index: GroupMoveAddress2 in C:\ProgramData\Symcon\scripts\12070.ips.php on line 48

Notice: Undefined index: GroupMoveAddress3 in C:\ProgramData\Symcon\scripts\12070.ips.php on line 48
,0/0/0
16740,Küchentür,KNX\Jalousie\Küchentür,3/2/22
16740,Küchentür,KNX\Jalousie\Küchentür,3/2/25
Notice: Undefined index: GroupPositionAddress1 in C:\ProgramData\Symcon\scripts\12070.ips.php on line 48

Notice: Undefined index: GroupPositionAddress2 in C:\ProgramData\Symcon\scripts\12070.ips.php on line 48

Notice: Undefined index: GroupPositionAddress3 in C:\ProgramData\Symcon\scripts\12070.ips.php on line 48
,0/0/0

Korrektur: mit Lamelle/Schritt hat es nix zu tun, der Fehler in deinem Code liegt woanders. Beim Shutter wo der Fehler auftritt ist prefix=„GroupMove“ etc, der Code sucht beim Mapping für die hörenden GA also nach „GroupMoveAddress1“ und scheitert.

======== NACHTRAG ========

Auf der Basis des Codes von paresy, Slummy und anderen Forumskollegen habe ich nun eine Lösung für mich gebaut, vielleicht nutzt der Code auch sonst jemandem.

Einschränkungen: Implementiert sind Instanzen vom alten Typ KNX EIS, von neuen Typ KNX DPT sowie KNX Shutter mit den Funktionen Move, Stop und Position. Einige andere KNX-Instanztypen habe ich weggelassen da ich sie nicht verwende, die sind aber relativ leicht zu ergänzen.

Auch wenn der Nutzen von anderen Forumsfreunden bezweifelt wurde, mir gefällt es dass man nun seht einfach schauen kann wo welche GA eingetragen ist. Hier als Beispiel meine GA 0/0/80 = Rolladen zentral in der gefilterten Ansicht, sowie ein Beispiel wie der ungefilterte Baum mit GA in der Beschreibung aussieht.

Der Code ist angehängt:


// walk through all device instances and determine their module names
foreach (IPS_GetInstanceListByModuleType(3) as $instanceID) {
    $moduleName = IPS_GetInstance($instanceID)['ModuleInfo']['ModuleName'];

    if ((strpos($moduleName, 'KNX EIS') !== false) || (strpos($moduleName, 'DPT') !== false)) {
        $InstanceName = IPS_GetName($instanceID);
        $RM_text = "";

        // "KNX EIS" (old type)
        if (strpos($moduleName, 'KNX EIS') !== false)  {
            $Instance_Type = "EIS";
            $GA_text = get_primary_GA ($instanceID, "GroupAddress"); 
            $RM_text = get_additional_GA($instanceID,"GroupMapping");
        }

        // "DPT" (new type)
        if (strpos($moduleName, 'DPT') !== false)  {
            $Instance_Type = "DPT";
            $GA_text = get_primary_GA ($instanceID, "Address"); 
            $RM_text = get_additional_GA($instanceID,"Mapping");
        }
       
        echo $instanceID, "  ", $Instance_Type, "  ", $GA_text, " ", $RM_text, "\t",   $InstanceName, "\n";

        // set group address in info field
        IPS_SetInfo($instanceID,  $GA_text . " " . $RM_text);
    }

    
    if (strpos($moduleName, 'KNX Shutter') !== false) {
        $InstanceName = IPS_GetName($instanceID);    
        $Instance_Type = "JAL";

        $GA_MOVE_text = get_primary_GA ($instanceID, "GroupMoveAddress"); 
        $RM_MOVE_text = get_additional_GA($instanceID,"GroupMoveMapping");

        $GA_STOP_text = get_primary_GA ($instanceID, "GroupStopAddress"); 
        $RM_STOP_text = get_additional_GA($instanceID,"GroupStopMapping");

        $combined_text = sprintf("%s %s, % s %s", $GA_MOVE_text, $RM_MOVE_text, $GA_STOP_text, $RM_STOP_text);

        if (IPS_GetProperty($instanceID, "EnablePosition")) {
            $GA_POS_text = get_primary_GA ($instanceID, "GroupPositionAddress"); 
            $RM_POS_text = get_additional_GA($instanceID,"GroupPositionMapping");

            $combined_text = $combined_text .  sprintf(", %s %s", $GA_POS_text, $RM_POS_text);
        }  

        echo $instanceID, "  ", $Instance_Type, "  ", $combined_text, "\t",   $InstanceName, "\n";

        // set group address in info field
        IPS_SetInfo($instanceID, $combined_text);

    }    
}


function get_primary_GA ($id, $Keyword) {
    $c = json_decode(IPS_GetConfiguration($id), true);
    $GA = sprintf("%d/%d/%d",  $c[$Keyword . "1"], $c[$Keyword . "2"], $c[$Keyword . "3"]);
    return $GA;
}


function get_additional_GA ($id, $Keyword) {
    $isDPT = ($Keyword=="Mapping");
    if ($isDPT) $MappingKey="Address"; else $MappingKey="GroupAddress";
    $RM_GA = "";

    $c = json_decode(IPS_GetConfiguration($id), true);
    foreach (json_decode($c[$Keyword], true) as $a) {
        $RM_GA = $RM_GA . sprintf("(%d/%d/%d)",  $a[$MappingKey . "1"], $a[$MappingKey . "2"], $a[$MappingKey . "3"]);
    }
    return $RM_GA;
}
5 „Gefällt mir“