I have flow which has been working just fine up until i updated the unifi node.
Now i get an error:
"TypeError: msg.payload[0].filter is not a function"
I'll be honest and say i no nothing about writing function nodes, so im not exactly sure how to dubug this error...but will assume the message arriving has changed in some way
Appreciate any advice
Cheers
[{"id":"d11d8210d610770b","type":"inject","z":"8912d148.68c81","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":420,"wires":[["368d2906.ef3a66"]]},{"id":"368d2906.ef3a66","type":"Unifi","z":"8912d148.68c81","name":"Unifi","server":"1a296781e30e2e26","command":"20","x":310,"y":260,"wires":[["96ea60062db1758a"]]},{"id":"96ea60062db1758a","type":"function","z":"8912d148.68c81","name":"Determine device presence","func":"const lastSeenSeconds = 20;\nlet presenceCutoff = (new Date() - (lastSeenSeconds * 1000)) / 1000; \nconst people = {\n \"Adam/presence/unifi\": \"GalaxyNote8\",\n \"Trina/presence/unifi\": \"S22_Ultra\",\n \"Jenny/presence/unifi\": \"Jenny-Iphone\"\n};\n\nreturn Object.keys(people).map(function(topic) {\n let devices = msg.payload[0].filter(device => device.name === people[topic] && device.last_seen > presenceCutoff);\n return {\n topic: topic,\n retain: true,\n payload: devices.length > 0\n };\n});","outputs":4,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":260,"wires":[["2a4f5f6bd6cd9a46","b7f44097c3e7906a"],["b65ee81b4bd925f8"],["36af771d.ff3ce8"],[]]},{"id":"2a4f5f6bd6cd9a46","type":"rbe","z":"8912d148.68c81","name":"","func":"rbe","gap":"","start":"","inout":"out","x":730,"y":260,"wires":[["25368c2c2d704da4"]]},{"id":"b7f44097c3e7906a","type":"debug","z":"8912d148.68c81","name":"debug 12","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":800,"y":400,"wires":[]},{"id":"1a296781e30e2e26","type":"unificonfig","name":"","ip":"192.168.1.12","port":"8443","site":"default","unifios":false,"ssl":false}]