Support cfg in foundation and functional (#390)

* Support cfg in foundation and functional

* Update zigbee-shepherd-converters.
This commit is contained in:
Viet Dzung
2018-09-29 23:05:18 +02:00
committed by Koenkk
parent 03d913defc
commit b06e3b61f2
3 changed files with 13 additions and 10 deletions
+2 -1
View File
@@ -557,7 +557,8 @@ class Controller {
}
};
this.zigbee.publish(deviceID, message.cid, message.cmd, message.zclData, ep, message.type, callback);
this.zigbee.publish(deviceID, message.cid, message.cmd, message.zclData,
message.cfg, ep, message.type, callback);
published.push({message: message, converter: converter});
});
+7 -5
View File
@@ -183,19 +183,21 @@ class Zigbee {
return this.shepherd.find(device.ieeeAddr, 1);
}
publish(deviceID, cid, cmd, zclData, ep, type, callback) {
publish(deviceID, cid, cmd, zclData, cfg, 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`);
return;
}
logger.info(`Zigbee publish to '${deviceID}', ${cid} - ${cmd} - ${JSON.stringify(zclData)} - ${ep}`);
logger.info(`Zigbee publish to '${deviceID}', ${cid} - ${cmd}
- ${JSON.stringify(zclData)} - ${JSON.stringify(cfg)} - ${ep}`);
const callback_ = (error) => {
if (error) {
logger.error(
`Zigbee publish to '${deviceID}', ${cid} - ${cmd} - ${JSON.stringify(zclData)} - ${ep} ` +
`Zigbee publish to '${deviceID}', ${cid} - ${cmd} - ${JSON.stringify(zclData)}
- ${JSON.stringify(cfg)} - ${ep} ` +
`failed with error ${error}`);
}
@@ -203,9 +205,9 @@ class Zigbee {
};
if (type === 'functional') {
device.functional(cid, cmd, zclData, callback_);
device.functional(cid, cmd, zclData, cfg, callback_);
} else if (type === 'foundation') {
device.foundation(cid, cmd, [zclData], callback_);
device.foundation(cid, cmd, [zclData], cfg, callback_);
} else {
logger.error(`Unknown zigbee publish type ${type}`);
}
+4 -4
View File
@@ -356,7 +356,7 @@
},
"ansi-colors": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-0.2.0.tgz",
"resolved": "http://registry.npmjs.org/ansi-colors/-/ansi-colors-0.2.0.tgz",
"integrity": "sha1-csMd4qDZoszQysMMyYI+6y9kNLU=",
"requires": {
"ansi-bgblack": "^0.1.1",
@@ -4830,9 +4830,9 @@
}
},
"zigbee-shepherd-converters": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/zigbee-shepherd-converters/-/zigbee-shepherd-converters-3.0.5.tgz",
"integrity": "sha512-4jzcufFZKueuKEfRk5aGhKj1st8vbeY8098ciOS9IbAvTwF57XZ3lB1UDC4cd1mcuYmY2Zve3PggxSJAyYHOnQ==",
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/zigbee-shepherd-converters/-/zigbee-shepherd-converters-4.0.0.tgz",
"integrity": "sha512-r2mW+qnuyFp5FIwqkxEQlz8A3YoZ2FX3dk/TStOJtCLkuSnnB5IoAOCEXsasuli79YjbLQtZbhGL2qbrfjYDGA==",
"requires": {
"debounce": "*"
},