From 8828ee60aec8f4d0d5840dd64b3e66b94c91b931 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Sat, 30 Mar 2019 18:20:07 +0100 Subject: [PATCH] Setup reporting for all attributes when cluster has no attributes. #1064 --- lib/extension/deviceReport.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/extension/deviceReport.js b/lib/extension/deviceReport.js index 26cf764fe..24a286a57 100644 --- a/lib/extension/deviceReport.js +++ b/lib/extension/deviceReport.js @@ -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,