From f916ec5f4cfebb3fb47d55eaaf0fe30245437eb0 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Fri, 14 Sep 2018 08:31:11 +0200 Subject: [PATCH] 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 3ba4c1a6..7c2ffb45 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} ` +