From 191eb505d8d5b85b298ad64b78f3b2e13d168eaf Mon Sep 17 00:00:00 2001 From: Ben Francis Date: Thu, 11 Apr 2024 17:07:26 +0100 Subject: [PATCH] Stop all properties being removed by default --- zwave-classifier.js | 3 +++ zwave-node.js | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/zwave-classifier.js b/zwave-classifier.js index 7090f54..39c080a 100644 --- a/zwave-classifier.js +++ b/zwave-classifier.js @@ -758,6 +758,9 @@ class ZWaveClassifier { if (name[0] == '_') { property.visible = false; } + // Invisible properties are no longer exposed in Thing Descriptions so + // should eventually be removed entirely. + // See https://github.com/WebThingsIO/zwave-adapter/issues/140 return property; } diff --git a/zwave-node.js b/zwave-node.js index 465db8b..a4048be 100644 --- a/zwave-node.js +++ b/zwave-node.js @@ -73,8 +73,10 @@ class ZWaveNode extends Device { dict.zwClasses = this.zwClasses; dict.zwValues = this.zwValues; + // Remove invisible properties from the Thing Description + // See https://github.com/WebThingsIO/zwave-adapter/issues/140 for (const prop of Object.values(dict.properties)) { - if (!prop.visible) { + if (prop.hasOwnProperty('visible') && prop.visible === false) { delete dict.properties[prop.name]; } }