Skip to content

Commit

Permalink
Stop all properties being removed by default
Browse files Browse the repository at this point in the history
  • Loading branch information
benfrancis committed Apr 19, 2024
1 parent 9951762 commit c4cfb08
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/zb-classifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -1933,6 +1933,9 @@ ${(`0${d.getHours()}`).slice(-2)}:${(`0${d.getMinutes()}`).slice(-2)}:${(`0${d.g

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/zigbee-adapter/issues/334
}
property.setInitialReadNeeded();
property.defaultValue = defaultValue;
Expand Down
4 changes: 3 additions & 1 deletion src/zb-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,10 @@ class ZigbeeNode extends Device {
}
}

// Remove invisible properties from the Thing Description
// See https://github.com/WebThingsIO/zigbee-adapter/issues/334
for (const prop of Object.values(dict.properties)) {
if (!prop.visible) {
if (prop.hasOwnProperty('visible') && prop.visible === false) {
delete dict.properties[prop.name];
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/zb-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,11 @@ class ZigbeeProperty extends Property {
// and there is nothing that we can actually read.
return;
}
if (!this.visible && typeof this.value != 'undefined') {
if (
this.hasOwnProperty('visible') &&
this.visible === false &&
typeof this.value != 'undefined'
) {
// We already know the value for this invisible property,
// no need to read it again.
return;
Expand Down

0 comments on commit c4cfb08

Please sign in to comment.