Skip to content

Commit

Permalink
fix: ensure deviceClass is not null
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Nov 18, 2020
1 parent 864dbe3 commit dedd327
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 9 additions & 3 deletions lib/ZwaveClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,12 @@ function initNode (zwaveNode) {
manufacturer: 'Unknown manufacturer ' + zwaveNode.manufacturerId
}

const deviceClass = zwaveNode.deviceClass || {
basic: {},
generic: {},
specific: {}
}

// https://zwave-js.github.io/node-zwave-js/#/api/node?id=zwavenode-properties
node.manufacturerId = zwaveNode.manufacturerId
node.productId = zwaveNode.productId
Expand All @@ -587,9 +593,9 @@ function initNode (zwaveNode) {
node.isRouting = zwaveNode.isRouting
node.keepAwake = zwaveNode.keepAwake
node.deviceClass = {
basic: zwaveNode.deviceClass.basic.key,
generic: zwaveNode.deviceClass.generic.key,
specific: zwaveNode.deviceClass.specific.key
basic: deviceClass.basic.key,
generic: deviceClass.generic.key,
specific: deviceClass.specific.key
}

node.neighbors = zwaveNode.neighbors
Expand Down
4 changes: 1 addition & 3 deletions src/components/ControlPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1290,9 +1290,7 @@ export default {
} catch (error) {
return
}
} else if (
this.node_action === 'replaceFailedNode'
) {
} else if (this.node_action === 'replaceFailedNode') {
var secure = await this.$listeners.showConfirm(
'Node inclusion',
'Start inclusion in secure mode?'
Expand Down

0 comments on commit dedd327

Please sign in to comment.