Add extra acceptDevIncoming logging. #538

This commit is contained in:
Koen Kanters 2019-03-30 16:48:58 +01:00
parent 91bc56a09f
commit 2f52b851a9

View File

@ -99,18 +99,25 @@ class Zigbee {
}
_acceptDevIncoming(devInfo, callback) {
logger.debug(
`Accept device incoming with ieeeAddr '${devInfo.ieeeAddr}' permit join is '${this.getPermitJoin()}'`
);
if (this.getPermitJoin()) {
if (settings.get().ban.includes(devInfo.ieeeAddr)) {
logger.info(`Banned device tried to connect (${devInfo.ieeeAddr})`);
callback(null, false);
} else {
logger.debug(`Allowing device '${devInfo.ieeeAddr}' to join`);
callback(null, true);
}
} else {
if (this.getAllClients().find((d) => d.ieeeAddr === devInfo.ieeeAddr)) {
// Allow already connected devices to rejoin.
logger.debug(`Allowing device '${devInfo.ieeeAddr}' to join (already connected device)`);
callback(null, true);
} else {
logger.debug(`Not allowing '${devInfo.ieeeAddr}' to join`);
callback(null, false);
}
}