Merge pull request #355 from dzungpv/dev

Support Foundation Command for use in zigbee-shepherd converter
This commit is contained in:
Koen Kanters 2018-09-11 21:34:25 +02:00 committed by GitHub
commit f0f2dc847b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -541,7 +541,7 @@ class Controller {
}
};
this.zigbee.publish(deviceID, message.cid, message.cmd, message.zclData, ep, callback);
this.zigbee.publish(deviceID, message.cid, message.cmd, message.zclData, ep, message.type, callback);
published.push({message: message, converter: converter});
});

View File

@ -183,7 +183,7 @@ class Zigbee {
return this.shepherd.find(device.ieeeAddr, 1);
}
publish(deviceID, cid, cmd, zclData, ep, callback) {
publish(deviceID, cid, cmd, zclData, ep, type, callback) {
const device = this._findDevice(deviceID, ep);
if (!device) {
logger.error(`Zigbee cannot publish message to device because '${deviceID}' not known by zigbee-shepherd`);
@ -191,7 +191,8 @@ class Zigbee {
}
logger.info(`Zigbee publish to '${deviceID}', ${cid} - ${cmd} - ${JSON.stringify(zclData)} - ${ep}`);
device.functional(cid, cmd, zclData, (error) => {
device[type](cid, cmd, zclData, (error) => {
if (error) {
logger.error(
`Zigbee publish to '${deviceID}', ${cid} - ${cmd} - ${JSON.stringify(zclData)} - ${ep} ` +