2
0

fix(all): check onlyModels server side

This commit is contained in:
Pierre CLEMENT
2018-01-08 21:02:40 +01:00
parent 234f91c2cf
commit c85e131bc1
3 changed files with 11 additions and 13 deletions
+9 -2
View File
@@ -1,15 +1,22 @@
module.exports = (RED) => {
function getOnlyModelsValue(input) {
var cleanOnlyModels = [];
input.forEach((value) => {
cleanOnlyModels = cleanOnlyModels.concat(value.split(','));
});
return cleanOnlyModels;
}
function XiaomiAllNode(config) {
RED.nodes.createNode(this, config);
this.gateway = RED.nodes.getNode(config.gateway);
this.onlyModels = config.onlyModels;
this.onlyModels = getOnlyModelsValue(config.onlyModels || []);
this.excludedSids = config.excludedSids;
console.log(this.onlyModels);
this.isDeviceValid = (device) => {
console.log(device.sid, device.model, this.onlyModels, this.excludeSids);
if((!this.onlyModels || this.onlyModels.length == 0) && (!this.excludedSids || this.excludedSids.length == 0)) {
return true;
}