From 967a28f706e891604de1dd676c0fe83563964c48 Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Mon, 28 Dec 2020 13:58:21 +0100 Subject: [PATCH] fix: better zwave valueid parsing --- lib/ZwaveClient.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/ZwaveClient.js b/lib/ZwaveClient.js index 8fa72a26447..3c3032e4202 100644 --- a/lib/ZwaveClient.js +++ b/lib/ZwaveClient.js @@ -710,9 +710,13 @@ function parseValue (zwaveNode, zwaveValue, zwaveValueMeta) { const vID = getValueID(valueId) - const prevValue = node.values[vID] ? node.values[vID].value : null - valueId.value = - zwaveValue.newValue || prevValue || zwaveNode.getValue(zwaveValue) + valueId.value = zwaveNode.getValue(zwaveValue) + + if (valueId.value === undefined) { + const prevValue = node.values[vID] ? node.values[vID].value : undefined + valueId.value = + zwaveValue.newValue !== undefined ? zwaveValue.newValue : prevValue + } if (isCurrentValue(valueId)) { valueId.isCurrentValue = true