# Unifi presence control stopped working (after upgrade to node-red 3.0.2)

**URL:** <https://discourse.nodered.org/t/unifi-presence-control-stopped-working-after-upgrade-to-node-red-3-0-2/73162>\
**Category:** General\
**Created:** [4 January 2023 14:34 UTC](https://discourse.nodered.org/t/unifi-presence-control-stopped-working-after-upgrade-to-node-red-3-0-2/73162 "2023-01-04T14:34:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![github6043](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/github6043/32/73754_2.png) [@github6043](https://discourse.nodered.org/u/github6043)\
**Post date:** [4 January 2023 14:34 UTC](https://discourse.nodered.org/t/unifi-presence-control-stopped-working-after-upgrade-to-node-red-3-0-2/73162/1 "2023-01-04T14:34:26Z")

</div>

Hi all, I used a flow for quite some time to check with the unifi controller for connected clients. Serch criteria was the MAC. I assume, after noder-red upgrade to 3.0.2, this function stopped working.

const lastSeenSeconds = 15;  
let presenceCutoff = (new Date().getTime() - (lastSeenSeconds \* 1000)) / 1000;  
const people = {  
"presence/s": "d2:84:23:xxxxxx",  
"presence/j": "16:97:2a:xxxxxx"  
};

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

The original line in the function was

let devices = msg.payload[0].filter(device =\> device.name === people[topic] && device.last\_seen

--\> [Node-Red UniFi Presence.md · GitHub](https://gist.github.com/i8beef/ab6386f1bb8f25c154e51df9a465eb05)

Any idea why I get FALSE out of the function ?

---

<div class="post-metadata">

**Author:** ![github6043](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/github6043/32/73754_2.png) [@github6043](https://discourse.nodered.org/u/github6043)\
**Post date:** [4 January 2023 14:39 UTC](https://discourse.nodered.org/t/unifi-presence-control-stopped-working-after-upgrade-to-node-red-3-0-2/73162/2 "2023-01-04T14:39:46Z")

</div>

Hi all, I just found it, in the array that is received from unifi, the device.name is now device.mac.  
Now works just fine again.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 January 2023 14:39 UTC](https://discourse.nodered.org/t/unifi-presence-control-stopped-working-after-upgrade-to-node-red-3-0-2/73162/3 "2023-01-18T14:39:57Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
