Is this a local user? If not, you need to create a local user on your UDMP. I assume by the name that it is. But, I wanted to reiterate that.
Here is my presence flow. I had help with this, so I’m happy to share it. This checks active devices on Unifi and also checks owntracks for presence. Owntracks is a beast. But I’m not going to skimp the flow because I think someone could and would use the entire flow.
[{"id":"fbe411534cd57d36","type":"subflow","name":"Ping Status","info":"","category":"","in":[{"x":40,"y":140,"wires":[{"id":"da3e45d275aeb5dd"},{"id":"3147d2f356c74496"},{"id":"639e734e5e945a1f"}]}],"out":[{"x":1140,"y":200,"wires":[{"id":"404ab9a4eff10c45","port":"0"},{"id":"6addbc0af6da3997","port":"1"}]}],"env":[{"name":"ip","type":"str","value":"127.0.0.1"}],"meta":{},"color":"#DDAA99","status":{"x":700,"y":260,"wires":[{"id":"8b557b207283261a","port":0}]}},{"id":"be981b11edd798c0","type":"bigssh","z":"fbe411534cd57d36","name":"","commandLine":"ping -W 1 -c 1 ","commandArgs":"","minError":"2","minWarning":1,"noStdin":true,"format":"ascii","payloadIsArg":true,"myssh":"5c03f08e973d95fe","x":340,"y":200,"wires":[["8b557b207283261a"],[],[]]},{"id":"8b557b207283261a","type":"function","z":"fbe411534cd57d36","name":"Ping Phone Presence","func":"if(msg.payload.indexOf(\"ping statistics\") >= 0) {\n msg.payload = msg.payload.indexOf(\"100% packet loss\") < 0;\n node.status({fill:\"green\", shape:\"dot\", text:msg.payload});\n return msg\n}\nreturn null;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":200,"wires":[["404ab9a4eff10c45"]]},{"id":"404ab9a4eff10c45","type":"switch","z":"fbe411534cd57d36","name":"","property":"payload","propertyType":"msg","rules":[{"t":"false"},{"t":"true"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":200,"wires":[[],["6addbc0af6da3997"]]},{"id":"3147d2f356c74496","type":"stoptimer","z":"fbe411534cd57d36","duration":"1","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":180,"y":80,"wires":[["508beb86a3062ce7"],[]]},{"id":"f881b94cd7c6620e","type":"delay","z":"fbe411534cd57d36","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":700,"y":100,"wires":[["da3e45d275aeb5dd"]]},{"id":"639e734e5e945a1f","type":"change","z":"fbe411534cd57d36","name":"","rules":[{"t":"set","p":"#:(ram)::withinMinute","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":200,"y":40,"wires":[[]]},{"id":"508beb86a3062ce7","type":"change","z":"fbe411534cd57d36","name":"","rules":[{"t":"set","p":"#:(ram)::withinMinute","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":80,"wires":[[]]},{"id":"6addbc0af6da3997","type":"switch","z":"fbe411534cd57d36","name":"","property":"#:(ram)::withinMinute","propertyType":"flow","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":910,"y":220,"wires":[["f881b94cd7c6620e"],[]]},{"id":"da3e45d275aeb5dd","type":"change","z":"fbe411534cd57d36","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"ip","tot":"env"},{"t":"delete","p":"reset","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":140,"wires":[["be981b11edd798c0"]]},{"id":"5c03f08e973d95fe","type":"SSH_Credentials","host":"192.168.40.20","port":"22","userlabel":"[email protected]"},{"id":"6ebf835ed9fa5711","type":"Unifi","z":"985c4b52f04e10f7","name":"Get Active Devices","ip":"192.168.40.1","port":"443","site":"default","command":"20","unifios":true,"x":390,"y":600,"wires":[["253da6469cb1be99"]]},{"id":"253da6469cb1be99","type":"function","z":"985c4b52f04e10f7","name":"Check Presence","func":"const lastSeenSeconds = 20;\nlet presenceCutoff = (new Date() - (lastSeenSeconds * 1000)) / 1000; \nconst people = {\n \"presence/April\": \"30:24:67:53:b2:db\",\n \"presence/Jeff\": \"30:74:67:c5:7a:29\",\n \"presence/Sarah\": \"44:91:60:bc:8d:57\",\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 let devices = msg.payload[0].filter(device => device.mac === people[topic]);\n return {\n topic: topic,\n retain: true,\n payload: devices.length > 0\n };\n});","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":600,"wires":[["cb2409cab52beedc"],["13b84e07dfb7a414"],["f0ac9fb19fd54128"]]},{"id":"dc352ba808e7e150","type":"inject","z":"985c4b52f04e10f7","name":"run every 30s","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"30","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":600,"wires":[["6ebf835ed9fa5711"]]},{"id":"cb2409cab52beedc","type":"rbe","z":"985c4b52f04e10f7","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":750,"y":580,"wires":[["44a19d5c550ce643"]]},{"id":"13b84e07dfb7a414","type":"rbe","z":"985c4b52f04e10f7","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":750,"y":620,"wires":[["96e8b40c581271aa"]]},{"id":"e7dfa14e8a1aac38","type":"change","z":"985c4b52f04e10f7","name":"JeffUnifi","rules":[{"t":"delete","p":"JeffUnifiPresence","pt":"global"},{"t":"set","p":"JeffUnifiPresence","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1120,"y":620,"wires":[["101484ecd93f0ba0"]]},{"id":"4da0e55633a0eea1","type":"change","z":"985c4b52f04e10f7","name":"AprilUnifi","rules":[{"t":"delete","p":"AprilUnifiPresence","pt":"global"},{"t":"set","p":"AprilUnifiPresence","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1120,"y":580,"wires":[["176573af33ba33d9"]]},{"id":"6598384a10d838d0","type":"function","z":"985c4b52f04e10f7","name":".event->payload","func":"return {\n payload:msg.payload.event,\n }\n;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":520,"wires":[["10a7b4b09804e447"]]},{"id":"10a7b4b09804e447","type":"rbe","z":"985c4b52f04e10f7","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":850,"y":520,"wires":[["1c8097f67cb50b71"]]},{"id":"1c8097f67cb50b71","type":"change","z":"985c4b52f04e10f7","name":"enter->home, leave->away","rules":[{"t":"change","p":"payload","pt":"msg","from":"enter","fromt":"str","to":"home","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"leave","fromt":"str","to":"away","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1040,"y":520,"wires":[["400c47487c9d2652"]]},{"id":"400c47487c9d2652","type":"change","z":"985c4b52f04e10f7","name":"Set Global April OwnTracks ","rules":[{"t":"set","p":"OwnTrxA","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1300,"y":520,"wires":[["422b4ff55edbfaca"]]},{"id":"951ed37ee860947c","type":"function","z":"985c4b52f04e10f7","name":".event->payload","func":"return {\n payload:msg.payload.event,\n }\n;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":680,"wires":[["b8efdf5f39d0cccb"]]},{"id":"b8efdf5f39d0cccb","type":"rbe","z":"985c4b52f04e10f7","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":850,"y":680,"wires":[["7fbd51ea1e64d937"]]},{"id":"7fbd51ea1e64d937","type":"change","z":"985c4b52f04e10f7","name":"enter->home, leave->away","rules":[{"t":"change","p":"payload","pt":"msg","from":"enter","fromt":"str","to":"home","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"leave","fromt":"str","to":"away","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1040,"y":680,"wires":[["4c2f88994f4e2183"]]},{"id":"4c2f88994f4e2183","type":"change","z":"985c4b52f04e10f7","name":"Set Global Jeff OwnTracks ","rules":[{"t":"set","p":"OwnTrxJ","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1300,"y":680,"wires":[["7b59bc903065aa1f"]]},{"id":"96e8b40c581271aa","type":"change","z":"985c4b52f04e10f7","name":"false->away,true->home","rules":[{"t":"change","p":"payload","pt":"msg","from":"false","fromt":"bool","to":"away","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"home","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":620,"wires":[["e7dfa14e8a1aac38"]]},{"id":"44a19d5c550ce643","type":"change","z":"985c4b52f04e10f7","name":"false->away,true->home","rules":[{"t":"change","p":"payload","pt":"msg","from":"false","fromt":"bool","to":"away","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"home","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":580,"wires":[["4da0e55633a0eea1"]]},{"id":"176573af33ba33d9","type":"switch","z":"985c4b52f04e10f7","name":"Unifi Status","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"home","vt":"str"},{"t":"eq","v":"away","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1290,"y":580,"wires":[["2c19bfc72685c936"],["4b8eb856a35a7c77"]]},{"id":"101484ecd93f0ba0","type":"switch","z":"985c4b52f04e10f7","name":"Unifi Status","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"away","vt":"str"},{"t":"eq","v":"home","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1290,"y":620,"wires":[["f91b7eaf7e5afe39"],["76f45c58c569de01"]]},{"id":"4b8eb856a35a7c77","type":"switch","z":"985c4b52f04e10f7","name":"OwnTracks Away","property":"OwnTrxA","propertyType":"global","rules":[{"t":"eq","v":"away","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1510,"y":580,"wires":[["cc127bea6c55c2fe"]]},{"id":"f91b7eaf7e5afe39","type":"switch","z":"985c4b52f04e10f7","name":"OwnTracks Away","property":"OwnTrxJ","propertyType":"global","rules":[{"t":"eq","v":"away","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1510,"y":620,"wires":[["c7966d57349ba5bf"]]},{"id":"7b59bc903065aa1f","type":"switch","z":"985c4b52f04e10f7","name":"Owntracks Status","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"home","vt":"str"},{"t":"eq","v":"away","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1530,"y":680,"wires":[["76f45c58c569de01"],["d9157c7cc0044776","8a5d2d74a1d8e2f4"]]},{"id":"d9157c7cc0044776","type":"switch","z":"985c4b52f04e10f7","name":"Unifi away","property":"#:(file)::JeffUnifiPresence","propertyType":"global","rules":[{"t":"eq","v":"away","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1730,"y":700,"wires":[["c7966d57349ba5bf"]]},{"id":"1a1e3c087162d891","type":"switch","z":"985c4b52f04e10f7","name":"Unifi away","property":"AprilUnifiPresence","propertyType":"global","rules":[{"t":"eq","v":"away","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1710,"y":480,"wires":[["cc127bea6c55c2fe"]]},{"id":"422b4ff55edbfaca","type":"switch","z":"985c4b52f04e10f7","name":"Owntracks Status","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"away","vt":"str"},{"t":"eq","v":"home","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1530,"y":520,"wires":[["41d6be1c237c59fe","1a1e3c087162d891"],["2c19bfc72685c936"]]},{"id":"cc127bea6c55c2fe","type":"change","z":"985c4b52f04e10f7","name":"set away","rules":[{"t":"set","p":"payload","pt":"msg","to":"away","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1900,"y":580,"wires":[["afe0b5a619dc1205"]]},{"id":"2c19bfc72685c936","type":"change","z":"985c4b52f04e10f7","name":"set home","rules":[{"t":"set","p":"payload","pt":"msg","to":"home","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1900,"y":540,"wires":[["afe0b5a619dc1205"]]},{"id":"afe0b5a619dc1205","type":"rbe","z":"985c4b52f04e10f7","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":2070,"y":560,"wires":[["9bdfc7af9d2849d1"]]},{"id":"c7966d57349ba5bf","type":"change","z":"985c4b52f04e10f7","name":"set away","rules":[{"t":"set","p":"payload","pt":"msg","to":"away","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1900,"y":620,"wires":[["60129b31481223d7"]]},{"id":"76f45c58c569de01","type":"change","z":"985c4b52f04e10f7","name":"set home","rules":[{"t":"set","p":"payload","pt":"msg","to":"home","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1900,"y":660,"wires":[["60129b31481223d7"]]},{"id":"60129b31481223d7","type":"rbe","z":"985c4b52f04e10f7","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":2070,"y":640,"wires":[["df6cd38ecea59e98"]]},{"id":"9bdfc7af9d2849d1","type":"change","z":"985c4b52f04e10f7","name":"Set April Home Status","rules":[{"t":"set","p":"topic","pt":"msg","to":"April","tot":"str"},{"t":"set","p":"AprilStatus","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2240,"y":560,"wires":[[]]},{"id":"df6cd38ecea59e98","type":"change","z":"985c4b52f04e10f7","name":"Set Jeff Home Status","rules":[{"t":"set","p":"topic","pt":"msg","to":"Jeff","tot":"str"},{"t":"set","p":"JeffStatus","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2240,"y":640,"wires":[[]]},{"id":"6d2ca8dcbb1b4a08","type":"mqtt in","z":"985c4b52f04e10f7","name":"Jeff","topic":"owntracks/roger/JeffB/event","qos":"2","datatype":"auto","broker":"3f792c51bc3d4765","nl":false,"rap":true,"rh":0,"inputs":0,"x":270,"y":680,"wires":[["cc61fdeff0f68e68"]]},{"id":"e231b9167d714952","type":"mqtt in","z":"985c4b52f04e10f7","name":"April","topic":"owntracks/roger/AprilB/event","qos":"2","datatype":"auto","broker":"3f792c51bc3d4765","nl":false,"rap":true,"rh":0,"inputs":0,"x":270,"y":520,"wires":[["c1833444f2dc49ac"]]},{"id":"c1833444f2dc49ac","type":"owntracks","z":"985c4b52f04e10f7","x":410,"y":520,"wires":[["12c01b9931a4ac61"]]},{"id":"cc61fdeff0f68e68","type":"owntracks","z":"985c4b52f04e10f7","x":410,"y":680,"wires":[["5c2dbcb701d9f8b8"]]},{"id":"12c01b9931a4ac61","type":"switch","z":"985c4b52f04e10f7","name":"","property":"payload.desc","propertyType":"msg","rules":[{"t":"eq","v":"Home","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":550,"y":520,"wires":[["6598384a10d838d0"]]},{"id":"41d6be1c237c59fe","type":"subflow:fbe411534cd57d36","z":"985c4b52f04e10f7","name":"April","env":[{"name":"ip","value":"192.168.10.12","type":"str"}],"x":1570,"y":420,"wires":[["8b252df5e6672c42"]]},{"id":"8a5d2d74a1d8e2f4","type":"subflow:fbe411534cd57d36","z":"985c4b52f04e10f7","name":"Jeff","env":[{"name":"ip","value":"192.168.10.10","type":"str"}],"x":1590,"y":760,"wires":[["901b599064b0ac88"]]},{"id":"8b252df5e6672c42","type":"switch","z":"985c4b52f04e10f7","name":"PingAway","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":1720,"y":420,"wires":[["cc127bea6c55c2fe"]]},{"id":"901b599064b0ac88","type":"switch","z":"985c4b52f04e10f7","name":"PingAway","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":1740,"y":760,"wires":[["c7966d57349ba5bf"]]},{"id":"5c2dbcb701d9f8b8","type":"switch","z":"985c4b52f04e10f7","name":"","property":"payload.desc","propertyType":"msg","rules":[{"t":"eq","v":"home","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":550,"y":680,"wires":[["951ed37ee860947c"]]},{"id":"f0ac9fb19fd54128","type":"rbe","z":"985c4b52f04e10f7","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":750,"y":720,"wires":[["85bb8aaba3be0940"]]},{"id":"bfd564828b49aa6c","type":"change","z":"985c4b52f04e10f7","name":"SarahUnifi","rules":[{"t":"delete","p":"SarahUnifiPresence","pt":"global"},{"t":"set","p":"SarahUnifiPresence","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":720,"wires":[[]]},{"id":"85bb8aaba3be0940","type":"change","z":"985c4b52f04e10f7","name":"false->away,true->home","rules":[{"t":"change","p":"payload","pt":"msg","from":"false","fromt":"bool","to":"away","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"home","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":720,"wires":[["bfd564828b49aa6c"]]},{"id":"3f792c51bc3d4765","type":"mqtt-broker","name":"CORE Clean1","broker":"10.10.2.1","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"5","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]
So the unifi flow injects every 30 seconds to check active devices. The node puts out a bit of data, so use the function that’s there. That moves in to the filter that filters each device by topic. Changes true and false to home and away for reference and sets a global to be used later. Then it filters the status and moves through to the appropriate command. Mode. St the end it will set the combined status of owntracks and unifi.
@RRodman helped me with some of the logic & @jchurch helped me with the functions on this. Take this and tailor it to your needs. It’s been solid. Owntracks is a different beast. Once you get it set up, its a matter of using it here. I’ve changed ip addresses and secrets. Use your own.
The end outputs: see what they put out for data. use this to trigger other flows.