From 469a01ebb665ade9da37edd9e785716d1ba1135c Mon Sep 17 00:00:00 2001 From: Viet Dzung Date: Fri, 14 Sep 2018 10:01:07 +0700 Subject: [PATCH 1/3] Fix foundation error from #8433571 --- lib/zigbee.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/zigbee.js b/lib/zigbee.js index bfe50d4b2..3ba4c1a65 100644 --- a/lib/zigbee.js +++ b/lib/zigbee.js @@ -192,7 +192,7 @@ class Zigbee { logger.info(`Zigbee publish to '${deviceID}', ${cid} - ${cmd} - ${JSON.stringify(zclData)} - ${ep}`); - device[type](cid, cmd, zclData, (error) => { + device[type](cid, cmd, [zclData], (error) => { if (error) { logger.error( `Zigbee publish to '${deviceID}', ${cid} - ${cmd} - ${JSON.stringify(zclData)} - ${ep} ` + From f916ec5f4cfebb3fb47d55eaaf0fe30245437eb0 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Fri, 14 Sep 2018 08:31:11 +0200 Subject: [PATCH 2/3] Update foundation publish --- lib/zigbee.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/zigbee.js b/lib/zigbee.js index 3ba4c1a65..7c2ffb455 100644 --- a/lib/zigbee.js +++ b/lib/zigbee.js @@ -191,8 +191,15 @@ class Zigbee { } logger.info(`Zigbee publish to '${deviceID}', ${cid} - ${cmd} - ${JSON.stringify(zclData)} - ${ep}`); - - device[type](cid, cmd, [zclData], (error) => { + + let func = null; + if (type === 'foundation') { + func = (cb) => device.foundation(cid, cmd, [zclData], cb); + } else if (type === 'functional') { + func = (cb) => device.functional(cid, cmd, zclData, cb); + } + + func((error) => { if (error) { logger.error( `Zigbee publish to '${deviceID}', ${cid} - ${cmd} - ${JSON.stringify(zclData)} - ${ep} ` + From d5de918247cd6e81a91a740fee1cc643ad412b30 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Fri, 14 Sep 2018 08:33:28 +0200 Subject: [PATCH 3/3] Revert --- lib/zigbee.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/zigbee.js b/lib/zigbee.js index 7c2ffb455..3ba4c1a65 100644 --- a/lib/zigbee.js +++ b/lib/zigbee.js @@ -191,15 +191,8 @@ class Zigbee { } logger.info(`Zigbee publish to '${deviceID}', ${cid} - ${cmd} - ${JSON.stringify(zclData)} - ${ep}`); - - let func = null; - if (type === 'foundation') { - func = (cb) => device.foundation(cid, cmd, [zclData], cb); - } else if (type === 'functional') { - func = (cb) => device.functional(cid, cmd, zclData, cb); - } - - func((error) => { + + device[type](cid, cmd, [zclData], (error) => { if (error) { logger.error( `Zigbee publish to '${deviceID}', ${cid} - ${cmd} - ${JSON.stringify(zclData)} - ${ep} ` +