Skip to content

Commit c4cfb08

Browse files
committed
Stop all properties being removed by default
1 parent 9951762 commit c4cfb08

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/zb-classifier.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,6 +1933,9 @@ ${(`0${d.getHours()}`).slice(-2)}:${(`0${d.getMinutes()}`).slice(-2)}:${(`0${d.g
19331933

19341934
if (name[0] == '_') {
19351935
property.visible = false;
1936+
// Invisible properties are no longer exposed in Thing Descriptions so
1937+
// should eventually be removed entirely.
1938+
// See https://github.com/WebThingsIO/zigbee-adapter/issues/334
19361939
}
19371940
property.setInitialReadNeeded();
19381941
property.defaultValue = defaultValue;

src/zb-node.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,10 @@ class ZigbeeNode extends Device {
236236
}
237237
}
238238

239+
// Remove invisible properties from the Thing Description
240+
// See https://github.com/WebThingsIO/zigbee-adapter/issues/334
239241
for (const prop of Object.values(dict.properties)) {
240-
if (!prop.visible) {
242+
if (prop.hasOwnProperty('visible') && prop.visible === false) {
241243
delete dict.properties[prop.name];
242244
}
243245
}

src/zb-property.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,11 @@ class ZigbeeProperty extends Property {
871871
// and there is nothing that we can actually read.
872872
return;
873873
}
874-
if (!this.visible && typeof this.value != 'undefined') {
874+
if (
875+
this.hasOwnProperty('visible') &&
876+
this.visible === false &&
877+
typeof this.value != 'undefined'
878+
) {
875879
// We already know the value for this invisible property,
876880
// no need to read it again.
877881
return;

0 commit comments

Comments
 (0)