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} ` +