diff --git a/lib/ZwaveClient.js b/lib/ZwaveClient.js index d44c7c54bc..0ae65973b5 100644 --- a/lib/ZwaveClient.js +++ b/lib/ZwaveClient.js @@ -902,7 +902,8 @@ function initNode (zwaveNode) { node.endpointsCount = zwaveNode.getEndpointCount() node.isSecure = zwaveNode.isSecure node.isBeaming = zwaveNode.isBeaming - node.isListening = zwaveNode.isListening || zwaveNode.isControllerNode() // Fixes #739 + node.isControllerNode = zwaveNode.isControllerNode() + node.isListening = zwaveNode.isListening node.isFrequentListening = zwaveNode.isFrequentListening node.isRouting = zwaveNode.isRouting node.keepAwake = zwaveNode.keepAwake diff --git a/src/components/custom/ZwaveGraph.vue b/src/components/custom/ZwaveGraph.vue index 52bb830699..c764e690d9 100644 --- a/src/components/custom/ZwaveGraph.vue +++ b/src/components/custom/ZwaveGraph.vue @@ -730,15 +730,13 @@ export default { nodes: [] } - let hubNode = 0 + let hubNode = this.nodes.find(n => n.isControllerNode) + hubNode = hubNode ? hubNode.id : 1 + const neighbors = {} for (const node of this.nodes) { const id = node.id - // TODO: check if node is primary controller - if (id === 1) { - hubNode = id - } neighbors[id] = node.neighbors @@ -779,7 +777,10 @@ export default { (batlev !== undefined ? 'battery (' + batlev + '%)' : 'mains') + '\n Neighbors: ' + node.neighbors, - forwards: node.ready && !node.failed && node.isListening + forwards: + node.ready && + !node.failed && + (node.isListening || node.isControllerNode) // leave the isController check here } if (id === hubNode) { diff --git a/types/index.d.ts b/types/index.d.ts index 6b25bfeeeb..1867a2c4f6 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -105,6 +105,7 @@ export type Z2MNode = { isSecure: boolean isBeaming: boolean isListening: boolean + isControllerNode: boolean isFrequentListening: boolean isRouting: boolean keepAwake: boolean