Skip to content

Commit

Permalink
fix: prevent undefined values on refreshInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Dec 28, 2020
1 parent 052a043 commit efab02e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/ZwaveClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,12 @@ function parseValue (zwaveNode, zwaveValue, zwaveValueMeta) {
zwaveValue,
zwaveValueMeta
)
valueId.value = zwaveNode.getValue(zwaveValue)

const vID = getValueID(valueId)

const prevValue = node.values[vID] ? node.values[vID].value : null
valueId.value =
zwaveValue.newValue || prevValue || zwaveNode.getValue(zwaveValue)

if (isCurrentValue(valueId)) {
valueId.isCurrentValue = true
Expand All @@ -717,7 +722,7 @@ function parseValue (zwaveNode, zwaveValue, zwaveValueMeta) {
}
}

node.values[getValueID(valueId)] = valueId
node.values[vID] = valueId

return valueId
}
Expand Down

0 comments on commit efab02e

Please sign in to comment.