mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-27 21:20:03 +00:00
Refactor and remove unnecessary bind. #966
This commit is contained in:
@@ -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
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user