Skip to content

Commit

Permalink
LQI rsp: now using device type from node desc instead
Browse files Browse the repository at this point in the history
  • Loading branch information
tcharp38 committed Jun 17, 2024
1 parent 7073d81 commit 365252a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
17 changes: 11 additions & 6 deletions core/php/AbeilleLQI.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,12 @@ function msgFromParser($eqIdx) {
$nName = $knownFromJeedom[$nLogicId]['name'];
$nParentName = $knownFromJeedom[$nLogicId]['parent'];
$nIcon = $knownFromJeedom[$nLogicId]['icon'];
$zigbee = $knownFromJeedom[$nLogicId]['zigbee'];
} else {
$nName = "?";
$nParentName = "?";
$nIcon = 'defaultUnknown';
$zigbee = [];
}

$newNeighbor = array(
Expand All @@ -209,18 +211,20 @@ function msgFromParser($eqIdx) {
'icon' => $nIcon,
);

// Decode bitmap
// $bitMap = hexdec($N->bitMap);
// $attrType = ($bitMap >> 0) & 0x3;
$attrType = $N->devType;
// Note: device type from router are often bad. Therefore using info from node descriptor instead, if device is known to Jeedom
if (isset($zigbee['logicalType'])) {
$attrType = $zigbee['logicalType']; // Node descriptor/logical type info
logMessage("", " Using 'logicalType' for device type");
} else
$attrType = $N->devType; // Mgmt_lqi_rsp info
if ($attrType == 0) {
$newNeighbor['type'] = "Coordinator";
} else if ($attrType == 1) {
$newNeighbor['type'] = "Router";
newRouter($nLogicId);
} else if ($attrType== 2) {
$newNeighbor['type'] = "End Device";
} else { // $attrType== 3
} else { // other
$newNeighbor['type'] = "Unknown";
}

Expand Down Expand Up @@ -476,8 +480,9 @@ function interrogateEq($netName, $addr, $eqIdx) {
$knownFromJeedom[$eqLogicId]['parent'] = $objName;
$knownFromJeedom[$eqLogicId]['ieee'] = $eqLogic->getConfiguration('IEEE', '');
$knownFromJeedom[$eqLogicId]['icon'] = $eqLogic->getConfiguration('ab::icon', 'defaultUnknown');
// $objKnownFromAbeille[$eqLogicId] = $objName;
$knownFromJeedom[$eqLogicId]['zigbee'] = $eqLogic->getConfiguration('ab::zigbee', []);
logMessage("", " Eq='".$eqLogicId."', parent='".$objName."'");
logMessage("", " zigbee=".json_encode($knownFromJeedom[$eqLogicId]['zigbee']));
}

$queueLQIToCmd = msg_get_queue($abQueues["xToCmd"]["id"]);
Expand Down
1 change: 1 addition & 0 deletions docs/fr_FR/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- Support EmberZnet/EZSP: Qq avancées mineures.
- Onglet avancé: Ajout 'Type logique' & 'MAC capabilities'.
- Réparation: Améliorations.
- Carte réseau: Utilisation du 'logical type' du node descriptor au lieu de la réponse 'LQI mgmt rsp' souvent fausse.

## 240610-BETA-1

Expand Down

0 comments on commit 365252a

Please sign in to comment.