I want to enum/count each item (object) in DEVICES but lenght does not work... Can I be missing something please?
context.global.getDomainDevices = function(domain){
//Gets all devices from a specific domain
node.warn("getDomainDevices: Starting->" + domain);
devices = global.get("DEVICES");
ret="";
for (i=0; i<devices.length; i++){
node.warn("getDomainDevices: Item->" + devices[i]);
if (devices[i].domain === domain){
node.warn("getDomainDevices: Found->" + devices[i]);
//It is part of this domain
if (ret !== "" ){
ret += "," + devices[i];
}else{
ret = devices[i];
}
}
}
node.warn("getDomainDevices: Result->" + ret);
return ret;
}