From 5f6b37bf83a4bca3a1a451a2631d554afce41311 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Fri, 18 Jan 2019 22:11:01 +0100 Subject: [PATCH] Support mesh networks in grapvhiz networkmap. https://github.com/Koenkk/zigbee2mqtt/issues/652 --- lib/extension/networkMap.js | 8 +++----- npm-shrinkwrap.json | 4 ++-- package.json | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/extension/networkMap.js b/lib/extension/networkMap.js index c7a25bdd3..90afdfe78 100644 --- a/lib/extension/networkMap.js +++ b/lib/extension/networkMap.js @@ -42,7 +42,6 @@ class NetworkMap { graphviz(zigbee, topology) { let text = 'digraph G {\nnode[shape=record];\n'; - const lqiDevices = new Map(topology.map((d) => [d.ieeeAddr, d])); zigbee.getDevices().forEach((device) => { const labels = []; @@ -76,10 +75,9 @@ class NetworkMap { * NOTE: There are situations where a device is NOT in the topology, this can be e.g. * due to not responded to the lqi scan. In that case we do not add an edge for this device. */ - const lqiDevice = lqiDevices.get(device.ieeeAddr); - if (lqiDevice != undefined) { - text += ` "${device.ieeeAddr}" -> "${lqiDevice.parent}" [label="${lqiDevice.lqi}"]\n`; - } + topology.filter((e) => e.ieeeAddr === device.ieeeAddr).forEach((e) => { + text += ` "${device.ieeeAddr}" -> "${e.parent}" [label="${e.lqi}"]\n`; + }); }); text += '}'; diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 78134facc..6267abfe8 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -4803,8 +4803,8 @@ } }, "zigbee-shepherd": { - "version": "git+https://github.com/Koenkk/zigbee-shepherd.git#43278a2219d1733180ed353deb4b724b2b9437fa", - "from": "git+https://github.com/Koenkk/zigbee-shepherd.git#43278a2219d1733180ed353deb4b724b2b9437fa", + "version": "git+https://github.com/Koenkk/zigbee-shepherd.git#ab40740ed8b41636cb3de7aecb160eb34b14917a", + "from": "git+https://github.com/Koenkk/zigbee-shepherd.git#ab40740ed8b41636cb3de7aecb160eb34b14917a", "requires": { "areq": "^0.2.0", "busyman": "^0.3.0", diff --git a/package.json b/package.json index 08830ed58..3832a18c4 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "semver": "*", "winston": "2.4.2", "ziee": "*", - "zigbee-shepherd": "git+https://github.com/Koenkk/zigbee-shepherd.git#43278a2219d1733180ed353deb4b724b2b9437fa", + "zigbee-shepherd": "git+https://github.com/Koenkk/zigbee-shepherd.git#ab40740ed8b41636cb3de7aecb160eb34b14917a", "zigbee-shepherd-converters": "7.0.22", "zive": "*" },