# How to drop msg.payload from specific topics?

**URL:** <https://discourse.nodered.org/t/how-to-drop-msg-payload-from-specific-topics/88859>\
**Category:** General\
**Created:** [22 June 2024 12:10 UTC](https://discourse.nodered.org/t/how-to-drop-msg-payload-from-specific-topics/88859 "2024-06-22T12:10:18Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![daxliniere](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/daxliniere/32/42187_2.png) [@daxliniere](https://discourse.nodered.org/u/daxliniere)\
**Post date:** [23 June 2024 12:55 UTC](https://discourse.nodered.org/t/how-to-drop-msg-payload-from-specific-topics/88859/16 "2024-06-23T12:55:21Z")

</div>

The RPi rebooted, I'm back in.  
This is the function node that is fed from the Unifi node and has multiple outputs:

```auto
const lastSeenSeconds = 20;

let presenceCutoff = (Date.now() - (lastSeenSeconds * 1000)) / 1000; 
const people = {
    "presence/Phone1" : "xx:xx:xx:xx:xx:xx",
    "presence/Phone2" : "xx:xx:xx:xx:xx:xx",
    "presence/Phone3" : "xx:xx:xx:xx:xx:xx",
    "presence/Phone4" : "xx:xx:xx:xx:xx:xx",
    "presence/Phone5" : "xx:xx:xx:xx:xx:xx"
};

return Object.keys(people).map(function(topic) {
    let devices = msg.payload[0].filter(device => device.mac === people[topic]);
// let devices = msg.payload[0].filter(device => device.mac === people[topic]) && (device.last_seen > presenceCutoff);
    return {
        topic: topic,
        //retain: true,
        payload: devices.length > 0
    };
});

```

---

_[View the full topic](https://discourse.nodered.org/t/how-to-drop-msg-payload-from-specific-topics/88859)._
