fixed unvisible categorys

This commit is contained in:
jhartworks committed 2026-11-09 13:04:18 +01:00
1 parent 1de0a60bd0
commit 601be6719f
6 files changed
+590 -563

No files matched your search

+13 -2
View File
@@ -13,11 +13,19 @@ $objects = [
14 => ['ParentID' => 10, 'ObjectName' => 'Temperatur-Link', 'ObjectType' => 6, 'ObjectPosition' => 1],
15 => ['ParentID' => 0, 'ObjectName' => 'Leer', 'ObjectType' => 0, 'ObjectPosition' => 9],
16 => ['ParentID' => 10, 'ObjectName' => 'Skript', 'ObjectType' => 3, 'ObjectPosition' => 0],
17 => ['ParentID' => 10, 'ObjectName' => 'Bild', 'ObjectType' => 5, 'ObjectPosition' => 0]
17 => ['ParentID' => 10, 'ObjectName' => 'Bild', 'ObjectType' => 5, 'ObjectPosition' => 0],
18 => ['ParentID' => 0, 'ObjectName' => 'I/O', 'ObjectType' => 1, 'ObjectPosition' => 0],
19 => ['ParentID' => 18, 'ObjectName' => 'I/O-Wert', 'ObjectType' => 2, 'ObjectPosition' => 0],
20 => ['ParentID' => 0, 'ObjectName' => 'Kern', 'ObjectType' => 1, 'ObjectPosition' => 0],
21 => ['ParentID' => 0, 'ObjectName' => 'Splitter', 'ObjectType' => 1, 'ObjectPosition' => 0],
22 => ['ParentID' => 0, 'ObjectName' => 'Konfigurator', 'ObjectType' => 1, 'ObjectPosition' => 0],
23 => ['ParentID' => 0, 'ObjectName' => 'Discovery', 'ObjectType' => 1, 'ObjectPosition' => 0],
24 => ['ParentID' => 0, 'ObjectName' => 'Visualisierung', 'ObjectType' => 1, 'ObjectPosition' => 0]
];
function IPS_GetChildrenIDs(int $id): array { global $objects; return array_keys(array_filter($objects, static fn(array $object): bool => $object['ParentID'] === $id)); }
function IPS_ObjectExists(int $id): bool { global $objects; return isset($objects[$id]); }
function IPS_GetObject(int $id): array { global $objects; return [...$objects[$id], 'ObjectIsHidden' => $id === 12, 'ObjectIcon' => 'Temperature']; }
function IPS_GetObject(int $id): array { global $objects; return [...$objects[$id], 'ObjectIsHidden' => in_array($id, [10, 12], true), 'ObjectIcon' => 'Temperature']; }
function IPS_GetInstance(int $id): array { return ['ModuleInfo' => ['ModuleType' => [18 => 1, 20 => 0, 21 => 2, 22 => 4, 23 => 5, 24 => 6][$id] ?? 3]]; }
function IPS_GetName(int $id): string { global $objects; return $objects[$id]['ObjectName']; }
function IPS_GetLink(int $id): array { return ['TargetID' => 12]; }
function IPS_GetVariable(int $id): array { return ['VariableType' => 2, 'VariableProfile' => '', 'VariableCustomProfile' => '', 'VariableCustomAction' => 0, 'VariableAction' => 0]; }
@@ -36,4 +44,7 @@ check($nodes[10]['name'] === 'Haus / Altbau', 'Do not split object names into ar
check($nodes[12]['hidden'] === true && $nodes[12]['position'] === 5, 'Preserve hidden objects and console position');
check($nodes[14]['entity_id'] === $nodes[12]['entity_id'], 'A variable link selects its original target');
check(!isset($nodes[16]['entity_id']), 'Scripts are visible but are not variable selections');
check($nodes[10]['hidden'] === true && $nodes[11]['parent_id'] === 10, 'Hidden categories and all their children must be exported');
check(array_column(array_intersect_key($nodes, array_flip([18, 20, 21, 22, 23, 24])), 'module_type') === [1, 0, 2, 4, 5, 6], 'Export real module types for logical system grouping');
check($nodes[11]['module_type'] === 3 && $nodes[19]['parent_id'] === 18, 'Keep devices and system-variable parents unchanged in native export');
echo "OK: full native object hierarchy, positions, hidden nodes and variable links\n";