Identify people by mobile phone

I’ll love to see some of the flows you come up with .

I had started this thread ( Flow example for UniFi node) to try and gather more examples, so if you are up for it, it’ll be good to create a resource for others.

I assume that even using UniFi you are reliant on the phone being connected to the wifi. Therefore again when the phone disconnects after a period of non-use it will not be visible, and after being away from the home then on return it may not reconnect for some time.

This works on android devices running tasker, automagic and maybe more. No need for a "hack".

As soon as the phone changes the active cell, it triggers the event in automagic.

Why do you think that?

This requires you an additional item carrying around.
Also you have to install an NFC reader outside (or use an expensive long range reader).
And for things like opening the garden gate or lights on approach, nfc does not work.

With so many background tasks running on these devices nowadays, I’m not seeing much fall off the network. And if they do, it’s not for very long. Certain times might be more, e.g when the phone is put in to do not disturb, or if the low battery/save process kicks in.

But for me it is just one of my checks, I have motion sensor too, that at tell me if someone is moving in the house, sockets to tell me if certain appliances are on and also when the house alarm is disabled/enabled it will record who did it and lets me know. Plus the house has cameras too that can send a photo when movement seen

Not perfect by any stretch, still very much a work in progress - but it informs me of data that can allow me to make a good guess - and much of my focus is just on identifying someone when they are first seen..

For me this seems to vary quite a bit with phone types. Some seem more aggressive than others in switching off wifi. Also it has got more aggressive with later versions of Android (don't know about Apple phones at all).
I have just carried out some tests (using ping to the phone) on my Moto G5 running Android Oreo. I woke it up to make sure it was connected then left it alone, not in do not disturb mode.
After 4 minutes it disconnected.
Five minutes later it reconnected for six seconds.
Thirty seconds later it reconnected for four minutes.
Six minutes later it reconnected for five seconds.
Ten minutes later it reconnected for six seconds.
Fifteen minutes later it reconnected for five seconds.
and so on. As you can see, using this to determine whether I was in the house or not would not be very satisfactory.
Out of interest I am going to leave it logging overnight to see what happens.

1 Like

Thanks Colin,

Those timings are interesting to see, and make sense, if there is no activity going on (why check so often). It’ll be interesting to know how much you have running on that device, and also how often it is getting push notifications too, which could spring it back to life.

When it comes to identifying people, there was a post a while back that was good - Tracking a Mobile Device - which (putting the tracking part to one side) shows you how owntracks can help to provide another information point to let you know who is around. (Battery life due to regular check ins - is never good.)

Ah, I think I meant to say iOS! Not everyone uses Android. :slight_smile:

RSSI is a measure of wireless network signal. Most phones turn off wireless when sleeping so, by definition, there will be no RSSI. If there is, the phone must be doing something clever to keep part of itself awake.

Not so on my iPhones.

I've tried Owntracks too and some other 3rd-party tools. Best I could get down to was a "fence" of around 100m or so. I lot will depend on cell coverage, phone type, whether you are in an urban or rural setting and so on. To get best accuracy requires more awake time and so worse battery life.

For me personally, these things all add up to something too complex and fragile to bother with. I do report device activity to MQTT but I'm not doing anything with it right now. Plenty of other projects to keep me busy, I'll doubtless revisit at some future point.

Interesting thread though and gives me a few thoughts for the future.

Yep and that is the reason that the stuff i pointed to has chosen to use Bluetooth for location rather than WIFI

You can sprinkle as many Rpi Zero W (less than $10) around as you need to get blanket coverage and they talk to each other.

It is quite a complex bash script he has written that does lots of checking and handoffs etc to enable presence and location detection - well worth looking at the script fro some ideas

Craig

The best one i have found if Life360 - there is a Home Assistant module for it and it leaves owntracks for dead.

Craig

Yes, used that for a bit with the kids phones when they were younger.

Sounds like a cool set up..

Thinking about it some more - as my house was flood wired with cat 6 and network ports, during a major renovation - it would be cool if there was a POE Bluetooth module that I could plug in to ports in each room, and have it report back in the device ID and signal strength of any devices seen for Node Red to monitor and report on it.

Try this with a Pi Zero W:

1 Like

The above script is based on BT (bluetooth) but doesn't this require that bluetooth should always be switched on on all the mobile phone(s) you want to detect ?

Of course

I don't feel I trust this Monitor script (yet)

I did install it and built a simple NR flow subscribing to the topics of interest. I put my iPhone BT mac into the configuration and did also the remaining configuration as required. Fine, I could see that my phone was detected correctly, Turning BT off, it disappeared after a departure scanning round, with confidence dropping in steps until zero. Turning BT on again, the phone appeared again.

So far so good, but....

I was away from home today, from 9:40 am until 3:30 pm. When I looked into the debug log, I saw that my phone had been detected a couple of times with confidence higher then zero. The script believed I was home around 11:00 am !!!!

I will let the thing run it's test a bit longer to see :face_with_monocle: if this shows up again or if it was just a glitch in the machinery

1 Like

Head on over to the HA forum and post your findings over there - the guy is super responsive and will be able to look at the logs and give you an idea (or work out what happened)

Craig

Yes, sure, if I find it worth the effort. First I will evaluate if it could be of interest as a "subsystem" to NR and if this would be the "magic way" to solve a popular & interesting task.

What I use today is Owntracks and a long range iBeacon and it is "kind of reliable"

Hi guys,

Thanks everyone for interest in the topic. Special thanks for constructive comments and references:

  • About use of BT, NFC, buttons, ARP, etc. for human presence detection.
  • About tradeoff of mixing all the methods, stability and usability of results.

In between, I published Human presence detector flow which uses external python script.

The python script uses nmap and ping in dependency of need and accordingly to tradeoffs. Nmap abuses the network. Dedicated often ping abuse the mobile phone battery. Nothing is perfect. Trying to find a golden ratio.
This works for me whole day long :slight_smile: yeah, not that long.

Your opinion for improvement and weak points is appreciated.
For instant: adding users MAC manually in CSV is not very handy, needs usability improvement.

Hi Igor,
I've setup the Python script, Node-RED etc.. but don't seem to get anything arriving via MQTT although it says it'sconnected.ScreenShot015

Hi David,

I'm checking if it can be "unmatching case" problem in my code.
Could you meanwhile please do following:

  1. Replace in the csv file the MAC with upper case symbols.
  2. Remove inject and function node before the daemon node.

I'll get back soon with results of my check.
Thank you.

UPDATE: to be on the safe side, I updated the ptracker.py to version 0.4 when the MACs are processed inside as upper case. Please, download it: https://github.com/igrowing/RaspberryPi/blob/master/ptracker.py

Please, confirm, your mosquitto broker is up (you can subscribe to it, receive and publish messages) on the same Raspberry Pi where prtacker runs. My fault - i didn't state this item as prerequisite too.

Please, confirm, the topic of MQTT node in the flow is not changed shm/rpi/presence/ and broker is set to localhost:1883.