2
0

fix(all): fix filter of "all" node

Close #11
This commit is contained in:
Pierre CLEMENT
2018-01-08 20:41:04 +01:00
parent 4b981f0f79
commit 0b6b51ce34
2 changed files with 15 additions and 4 deletions

View File

@@ -6,12 +6,14 @@ module.exports = (RED) => {
this.gateway = RED.nodes.getNode(config.gateway);
this.onlyModels = config.onlyModels;
this.excludedSids = config.excludedSids;
console.log(this.onlyModels);
this.isDeviceValid = (device) => {
if((!this.onlyModels || this.onlyModels.length == 0) && (!this.excludedSids || this.excludedSids.length == 0)) {
return true;
}
// Is excluded
if((this.excludedSids && this.excludedSids.length != 0) && this.excludedSids.indexOf(device.sid) >= 0) {
return false;
}