Skip to content

Commit

Permalink
Merge pull request #2276 from asgothian/master
Browse files Browse the repository at this point in the history
Fix channel scan
  • Loading branch information
arteck authored Nov 3, 2024
2 parents 8ee2267 + 2099856 commit a5add52
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 51 deletions.
2 changes: 1 addition & 1 deletion admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2552,7 +2552,7 @@ function showChannels() {
}
}
});
showWaitingDialog('Scanning channels - not working yet', 10);
showWaitingDialog('Scanning channels', 10);
}

function onlyOne(devs) {
Expand Down
61 changes: 11 additions & 50 deletions lib/zigbeecontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1007,63 +1007,24 @@ class ZigbeeController extends EventEmitter {
}

async getChannelsEnergy() {
/*
const BLANK_EUI64 = "0xFFFFFFFFFFFFFFFF";
const SLEEPY = 0xffff;
let clusterId = ZDO.ClusterId.NWK_UPDATE_REQUEST;
//for (let i=26;i>0;i--)
{
const result = {};
try
{
let result = {};
let payload = ZDO.Buffalo.buildRequest(false, clusterId, [11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26], 0x05, undefined, 0, undefined);
this.warn(`Payload is [${JSON.stringify(payload)}]`);
result = await this.herdsman.adapter.sendZdo(0x0, 0x0, clusterId , payload, false);
this.warn(`result is ${JSON.stringify(result)}`)
//await this.Wait(5000);
//let payload1 = ZDO.Buffalo.buildRequest(true, clusterId, [16,17,18,19,20], 0x5, undefined, 0, undefined);
//result = await this.herdsman.adapter.sendZdo(0x0, 0x0, clusterId , payload1, false);
//this.warn(`result 2 is ${JSON.stringify(result)}`)
//await this.Wait(5000);
//let payload2 = ZDO.Buffalo.buildRequest(true, clusterId, [21,22,23,24,25], 0x5, undefined, 0, undefined);
//result = await this.herdsman.adapter.sendZdo(0x0, 0x0, clusterId , payload2, false);
//this.warn(`result 3 is ${JSON.stringify(result)}`)
/* const payload = {
dstaddr: 0x0,
dstaddrmode: 0x02,
channelmask: 0x07FFF800,
scanduration: 0x5,
scancount: 1,
nwkmanageraddr: 0x0000
};
const energyScan = this.herdsman.adapter.znp.waitFor(
2, // unpi_1.Constants.Type.AREQ,
5, // Subsystem.ZDO,
'mgmtNwkUpdateNotify'
);
await this.herdsman.adapter.znp.request(
0x5, // Subsystem.ZDO
'mgmtNwkUpdateReq',
payload,
energyScan.ID
);
const result = await energyScan.start().promise;
//return result.payload;
}
let payload = ZDO.Buffalo.buildRequest(false, clusterId, [11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26], 0x05, 1, 0, undefined);
const scanresult = await this.herdsman.adapter.sendZdo(0x0, 0x0, clusterId , payload, false);
this.debug(`scanresult is ${JSON.stringify(scanresult)}`)
result.energyvalues = scanresult[1].entryList;
this.debug(`result is ${JSON.stringify(result)}`)
}
catch (error) {
this.sendError(error);
this.error(`Failed to touchlinkReset ${error.stack}`);
this.error(`Failed to scan channels ${error.stack}`);
result.error = error;

}
}
*/
return result;
}
}

Expand Down

0 comments on commit a5add52

Please sign in to comment.