Identify people by mobile phone

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.

ScreenShot019 ScreenShot020

Implemented those changes - still get the same message.

ScreenShot021

Oops - only just spotted yr message about v0.4 which I've done

Not sure why/what you see the benefits of Wireless over BT ? BT LE (4.0 and above) have far less power draw on each device, have a far shorter range (and hence can give localised presence in a smaller geographical area) and i also understand that Iphones turn off their wireless when you put them into sleep mode in the evening etc ?

I have personally been playing around with the Bash script from the HA forum that i linked to earlier for the last week or so and it is pretty much rock solid - have not found a false positive yet.

Craig

That's the exact point why not, Craig :slight_smile:
My goal is not precise detection of user location. I just want my home to be aware of my proximity.
In addition, precise detection with BT requires BT transceiver with good distribution. That means many small appliances to add to existing infrastructure and maintain them. That's extra cost and extra waste time.

As well, no one in my surroundings whom I want to see in my house (especially at night!) has iphone :slight_smile:

Hi David,

For debug purposes I disable autostart and restart of daemon node, kill the ptracker in the shell and run it manually in foreground.
This allows me to see all prints and understand a little what happens.

For deeper debug,

  • try to ping your phone from the RaspberryPi. Does it respond?
  • arp -a - does it show the same MAC you've registered in the CSV? Does IP match the ping adress above?
  • sudo nmap -sn yournet/mask (example sudo nmap -sn 192.168.1.0/24). Do you see your phone responding? Is MAC correct?
  • ifconfig -a | grep -B1 "inet " - please, post your network details. I might have some wrong assumptions about network.

Thank you!

Hi,
Results are attached.

Pinging to my phone only works when the phone is unlocked, otherwise the
ping command just waits.

I haven't got 'nmap' installed on this particular RPi (I'll do it later).

Hope this is helpful

Regards, David

Hi David,

Yes, this helps.

ptracker uses nmap for correlation between MAC and IP. Please, run sudo apt-get install nmap before use of ptracker.py. I added this instruction to the flow description too.

As well, I Improved error detection and verbosity in the script itself version ptracker.py 0.5.

Indeed, not responding to ping while sleep might be problem of presence detection. I think this is tweakable/configurable in battery-saving related setting of the handset. For Samsung, Sony and ...tada... Oukitel I didn't encounter this problem.

Hi,
Tried the things you suggested as well as installing nmap.

'nmap' finds my Android phone.

As per attached listing - still do not get any thing via MQTT in.

Cheers from David.