# Hide inactive devices for node-red-node-pushbullet

**URL:** https://discourse.nodered.org/t/hide-inactive-devices-for-node-red-node-pushbullet/11548
**Category:** Feature Requests
**Created:** [26 May 2019 07:43 UTC](https://discourse.nodered.org/t/hide-inactive-devices-for-node-red-node-pushbullet/11548 "2019-05-26T07:43:48Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![okhiroyuki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/okhiroyuki/32/15056_2.png) [@okhiroyuki](https://discourse.nodered.org/u/okhiroyuki)
#### Post date: [26 May 2019 07:43 UTC](https://discourse.nodered.org/t/hide-inactive-devices-for-node-red-node-pushbullet/11548/1 "2019-05-26T07:43:48Z")

</div>

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.

 ![51](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/5a735f74f43e5d9503fd72f86d4d8e54997a666a.png)  
 ![26](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/527dea2810dad64efad267fd9d795960bdb892c4.jpeg)

## 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.

```auto
            config.pusher.devices(function(err, chans) {
                if (err) {
                    res.send("[]");
                    return onError(err, config);
                }
                res.send(JSON.stringify(chans.devices));
            });

```

 ![05](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/3e555ce2c458995a90d0dc8cb84fb17851b76762.png)

# How

This can be improved by adding a filter.

```auto
    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;
    }

```

## github

> <https://github.com/okhiroyuki/node-red-nodes/commit/2cbb598da571dde29bdf0bdbe722ed26a0955be7>

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [26 May 2019 08:00 UTC](https://discourse.nodered.org/t/hide-inactive-devices-for-node-red-node-pushbullet/11548/2 "2019-05-26T08:00:57Z")

</div>

Feel free to make that into a pull request

---

<div class="post-metadata">

### Author: ![okhiroyuki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/okhiroyuki/32/15056_2.png) [@okhiroyuki](https://discourse.nodered.org/u/okhiroyuki)
#### Post date: [26 May 2019 10:17 UTC](https://discourse.nodered.org/t/hide-inactive-devices-for-node-red-node-pushbullet/11548/3 "2019-05-26T10:17:43Z")

</div>

Thank you.  
I would like to make a pull request.

---

<div class="post-metadata">

### Author: ![okhiroyuki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/okhiroyuki/32/15056_2.png) [@okhiroyuki](https://discourse.nodered.org/u/okhiroyuki)
#### Post date: [26 May 2019 10:52 UTC](https://discourse.nodered.org/t/hide-inactive-devices-for-node-red-node-pushbullet/11548/4 "2019-05-26T10:52:21Z")

</div>

I posted a pull request.

> <https://github.com/node-red/node-red-nodes/pull/545>
