Refactor and remove unnecessary bind. #966

This commit is contained in:
Koen Kanters
2019-02-02 00:31:30 +01:00
parent 0d9741e511
commit ae08deb2fd
2 changed files with 5 additions and 7 deletions
+2 -4
View File
@@ -8,7 +8,7 @@ const candidates = {
};
const reportInterval = {
min: 2,
min: 1,
max: 3600,
};
@@ -40,9 +40,7 @@ class Reporting {
if (candidates[cluster]) {
const attributes = candidates[cluster].filter((a) => c.attrs.hasOwnProperty(a));
attributes.forEach((attribute) => {
this.zigbee.endpointBindCoordinator(endpoint, cluster);
this.zigbee.endpointReport(
this.zigbee.report(
endpoint,
cluster,
attribute,
+3 -3
View File
@@ -274,12 +274,12 @@ class Zigbee {
return endpoint;
}
endpointBindCoordinator(ep, cluster) {
bind(ep, cluster, target=this.getCoordinator()) {
const log = `for ${ep.device.ieeeAddr} - ${cluster}`;
this.queue.push((queueCallback) => {
logger.debug(`Setup binding ${log}`);
ep.bind(cluster, this.getCoordinator(), (error) => {
ep.bind(cluster, target, (error) => {
if (error) {
logger.error(`Failed to setup binding ${log} - (${error})`);
} else {
@@ -291,7 +291,7 @@ class Zigbee {
});
}
endpointReport(ep, cluster, attribute, min, max, change) {
report(ep, cluster, attribute, min, max, change) {
const attrId = zclId.attr(cluster, attribute).value;
const dataType = zclId.attrType(cluster, attribute).value;
const cfg = {direction: 0, attrId, dataType, minRepIntval: min, maxRepIntval: max, repChange: change};