From be93eb1aeb4ebe0882d14432e3237d14e4e049e3 Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Mon, 12 Feb 2024 16:08:49 +0100 Subject: [PATCH] fix: safe check --- api/lib/ZwaveClient.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/lib/ZwaveClient.ts b/api/lib/ZwaveClient.ts index 7e0b58274b1..ae23c516b50 100644 --- a/api/lib/ZwaveClient.ts +++ b/api/lib/ZwaveClient.ts @@ -5368,7 +5368,7 @@ class ZwaveClient extends TypedEventEmitter { if (zwaveNode.ready) { const res = this._addValue(zwaveNode, args) - if (res.valueId) { + if (res?.valueId) { const node = this._nodes.get(zwaveNode.id) this.subscribeObservers(node, res.valueId) } @@ -6229,7 +6229,8 @@ class ZwaveClient extends TypedEventEmitter { if (!valueId) { // node name and location emit a value update but // there could be no defined valueId as not all nodes - // support that CC but zwave-js does (https://github.com/zwave-js/zwave-js-ui/issues/3591) + // support that CC but zwave-js does, also we ignore it + // on `_valueAdded`. Ref: (https://github.com/zwave-js/zwave-js-ui/issues/3591) if ( args.commandClass === CommandClasses['Node Naming and Location']