From d4972e88a0170823ae9adc7755936e07bdce24c9 Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Mon, 1 Mar 2021 10:15:49 +0100 Subject: [PATCH] fix: use node `available` in node status (#762) --- lib/Gateway.js | 4 ++-- lib/ZwaveClient.js | 1 + types/index.d.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Gateway.js b/lib/Gateway.js index 99ba8f2df50..fdc4d128337 100755 --- a/lib/Gateway.js +++ b/lib/Gateway.js @@ -410,11 +410,11 @@ function onNodeStatus (node) { let data if (this.config.payloadType === 2) { - data = node.ready + data = node.available } else { data = { time: Date.now(), - value: node.ready, + value: node.available, status: node.status, nodeId: node.id } diff --git a/lib/ZwaveClient.js b/lib/ZwaveClient.js index d4f8da4ea8c..889ec79e3f3 100644 --- a/lib/ZwaveClient.js +++ b/lib/ZwaveClient.js @@ -339,6 +339,7 @@ function onNodeStatus (zwaveNode) { if (node) { // https://github.com/zwave-js/node-zwave-js/blob/master/packages/zwave-js/src/lib/node/Types.ts#L127 node.status = NodeStatus[zwaveNode.status] + node.available = zwaveNode.status !== NodeStatus.Dead node.interviewStage = InterviewStage[zwaveNode.interviewStage] this.emit('nodeStatus', node) } else { diff --git a/types/index.d.ts b/types/index.d.ts index c7f996febda..848fda907d6 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -118,6 +118,7 @@ export type Z2MNode = { values: Map groups: Z2MNodeGroups[] ready: boolean + available: boolean failed: boolean lastActive: number dbLink: string