Skip to content

Commit

Permalink
Setup reporting for all attributes when cluster has no attributes. #1064
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Mar 30, 2019
1 parent 55c3edf commit 8828ee6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/extension/deviceReport.js
Expand Up @@ -48,12 +48,15 @@ class DeviceReport {
}

logger.debug(`Setting up reporting for ${device.ieeeAddr}`);

Object.values(endpoint.clusters).filter((c) => c).forEach((c) => {
const cluster = c.attrs.cid;
if (candidates[cluster]) {
const candidate = candidates[cluster];
const attributeNames = candidate.attrs.filter((a) => c.attrs.hasOwnProperty(a));
let attributeNames = candidate.attrs.filter((a) => c.attrs.hasOwnProperty(a));

// Sometimes a cluster has no attributes, in this case setup reporting for all attributes.
attributeNames = attributeNames.length ? attributeNames : candidate.attrs;

const attributes = attributeNames.map((attribute) => {
return {
attr: attribute,
Expand Down

0 comments on commit 8828ee6

Please sign in to comment.