Hi.
I noticed that I was using node-red-node-pushbullet, so I posted.
What
node-red-node-pushbullet is displayed active and inactive devices in the list.
Environment
- Node-RED: v0.20.5
- Node.js: v10.13.0
- node-red-node-pushbullet : v0.0.12
- MacOS : 10.14.5
Why
pushbullet api have active flag of device.
But, The node just does not filter it.
config.pusher.devices(function(err, chans) {
if (err) {
res.send("[]");
return onError(err, config);
}
res.send(JSON.stringify(chans.devices));
});
How
This can be improved by adding a filter.
res.send(JSON.stringify(filterdActiveDevices(chans.devices)));
function filterdActiveDevices(devices){
var activeDevices = [];
for(var i=0;i<devices.length;i++){
if(devices[i].active){
activeDevices.push(devices[i]);
};
}
return activeDevices;
}