Update zigbee.js

Add "removedevice" Function into zigbee.js
This commit is contained in:
tb-killa 2018-06-04 10:55:00 +02:00 committed by Marius Ciotlos
parent ca27f9faf2
commit 0328ad7cb6

View File

@ -108,6 +108,22 @@ class Zigbee {
return this.shepherd.list().filter((device) => device.type !== 'Coordinator');
}
removedevice(deviceID) {
if (deviceID) {
logger.info(`Found Device with ID ${deviceID}`);
this.shepherd.remove('deviceID', function (err) {
if (err) {
console.log(`Failed to removed ${deviceID}`);
} else {
console.log(`Successfully removed ${deviceID}`);
}
});
} else {
logger.error('removedevice function need deviceID to proceed');
return;
}
}
ping(deviceID) {
const device = this.shepherd._findDevByAddr(deviceID);