Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): zwave graph when controller id != 1 #863

Merged
merged 2 commits into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/ZwaveClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions src/components/custom/ZwaveGraph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export type Z2MNode = {
isSecure: boolean
isBeaming: boolean
isListening: boolean
isControllerNode: boolean
isFrequentListening: boolean
isRouting: boolean
keepAwake: boolean
Expand Down