From 0c1dba7208e51f75f9ee5e3de3e361dd3899ec23 Mon Sep 17 00:00:00 2001 From: Koenkk Date: Wed, 19 Sep 2018 20:59:30 +0200 Subject: [PATCH] Fix functional command. #386 --- lib/zigbee.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/zigbee.js b/lib/zigbee.js index 3ba4c1a65..9cf55ec97 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) => { + const callback_ = (error) => { if (error) { logger.error( `Zigbee publish to '${deviceID}', ${cid} - ${cmd} - ${JSON.stringify(zclData)} - ${ep} ` + @@ -200,7 +200,15 @@ class Zigbee { } callback(error); - }); + }; + + if (type === 'functional') { + device.functional(cid, cmd, zclData, callback_); + } else if (type === 'foundation') { + device.foundation(cid, cmd, [zclData], callback_); + } else { + logger.error(`Unknown zigbee publish type ${type}`); + } } read(deviceID, cid, attr, ep, callback) {