Page 1 of 1

Best way for presence detection with smartphone?

Posted: Sat Nov 15, 2014 2:08 pm
by ThinkPad
Hello,

I am interested in how you guys manage presence detection. I use Domoticz on a Raspberry Pi. Certain events are based on the presence of a human being at home. I now use a Python script which pings my smartphone (LG Nexus 5), and the smartphone of my girlfriend (iPhone 4S). If a smartphone can't be reached, the cooldown period kicks in. After this period a virtual switch is turned off, so Domoticz knows there is nobody home.

However, i would like to know if there are better alternatives. One thing i am experiencing right now, is that the iPhone disconnects from the wifi when the screen is locked. The effect of this, is that i need a quite large cooldown period (45min). Otherwise the script would tell Domoticz that the iPhone is gone when you don't touch it for a while.
I also tried using ARP scan at the Raspberry, but the iPhone disappears completely from the network.

With my Nexus 5 the presence detection by pinging the device works quite good, because with Android you can configure that it leaves WiFi on when the screen is locked. The only problem i encounter is that sometimes the phone won't automatically connect to my WiFi. I sometimes first have to wake the device and then it connects. But i think this is a bug of my phone.

I don't want to use a PIR or doorcontacts, i think checking the smartphone is a good way, because we always have them with us when we leave the house. I also prefer doing the presence detection on the serverside, and not by some app on the phones, because this requires extra configuration, and is more prone for faults.

I plan on testing with Bluetooth between iPhone <> Domoticz (on the Raspberry).

Let me know what you use for presence detection

Re: Best way for presence detection with smartphone?

Posted: Mon Nov 17, 2014 11:00 am
by kriz83
Looking for something similar, only problem for me is that I put my phone in semi-airplane mode at night (no wifi, no wireless data).

Re: Best way for presence detection with smartphone?

Posted: Mon Nov 17, 2014 1:29 pm
by raymonvdm
I`m using ping to detect if the SmartPhones are on Wifi, but this is also working when visiting the Neighbors, so not really 100% accurate. Another option can be using geofence apps on the phones in such a way that the phones tells his location once in a while and therefore the house knows what to do.

I think this is a option (but did not try it yet) http://www.btraced.com/

Re: Best way for presence detection with smartphone?

Posted: Mon Nov 17, 2014 1:34 pm
by kriz83
I'm going to try AutoLocation with tasker on Android.
Will post back results.

Re: Best way for presence detection with smartphone?

Posted: Tue Nov 18, 2014 9:25 am
by Henk_J
I also tested autolocation on Android. Works fine but you cannot determine if your at home or drinking coffee at the neigbours. It's not that accurate.

Re: Best way for presence detection with smartphone?

Posted: Tue Nov 18, 2014 11:22 am
by kriz83
Henk_J wrote:I also tested autolocation on Android. Works fine but you cannot determine if your at home or drinking coffee at the neigbours. It's not that accurate.
I agree, but that's not really that big of an issue to me.
For some reason my phone often loses its WiFi connection, which makes HomeSeer think I left home...

Re: Best way for presence detection with smartphone?

Posted: Tue Nov 18, 2014 11:58 am
by 123unlock
here I use 2 methods, one is over WiFi and the second check is over bluetooth, i set my Phone to Always visible and then with an other tool do a scan for bluetooth devices in de neighborhood.

the controller that does the BT scanning is on the first floor, and have an range of about 10mtr so works fine for presence detection :)

Re: Best way for presence detection with smartphone?

Posted: Tue Nov 18, 2014 12:21 pm
by freakstar
Henk_J wrote:I also tested autolocation on Android. Works fine but you cannot determine if your at home or drinking coffee at the neigbours. It's not that accurate.
I also use Tasker, but then a check if connected to my WiFi network. If so then trough http change the status of my virtual device. On iPhone never got something similar like this working unfortunately.

I'm not a regular at my neighbours so that's a problem I don't have. :)

Re: Best way for presence detection with smartphone?

Posted: Tue Nov 18, 2014 3:06 pm
by Henk_J
I think bluetooth is the best option. I would prefer one of the solutions you can find on the crowdfunding sites like kickstarter that works with BLE tags. This saves your phone battery and you are able to detect if the dog chases the neigbours cat (that's the reason I drink coffee over there :-) )

Re: Best way for presence detection with smartphone?

Posted: Sun Nov 23, 2014 8:09 pm
by 123unlock
BTLE works cool.. here i use some "sticknfind" tags because you can change the battery inside but ofoucrse if you like more design you can also use something like Tile
main issue was on windows i was not able to talk directy to the BT stack, so ended up by adding it to an RPi with nodeJS and make it available as webservice to my domotica system

the stickNfinds are "hidden" devices, so you have to decode the RAW BT data, from there you can extract the MAC address, and the signal level
if you have 2 or more RPi with bluetooth 4.0 LE dongles you can even do "indoor" position tracking (stick the tag for example in your wallet, or use an FITBIT (as they also advertise over BTLE)

i made some scans here in the house, and on 2 Rpi i can detect in what room/floor the dongle is located :)

Code: Select all

-Found BTLE: DB:E5:0E:C0:41:84  Signal: 167 - Update DB: OK
-Found BTLE: CB:5C:79:20:D8:D2  Signal: 161 - Update DB: OK
-Found BTLE: D2:14:00:2D:C5:52  Signal: 164 - Update DB: OK
-Found BTLE: D2:14:00:2D:C5:52  Signal: 165 - Update DB: OK
-Found BTLE: DB:E5:0E:C0:41:84  Signal: 167 - Update DB: OK
-Found BTLE: DB:E5:0E:C0:41:84  Signal: 168 - Update DB: OK
-Found BTLE: CB:5C:79:20:D8:D2  Signal: 163 - Update DB: OK
-Found BTLE: D2:14:00:2D:C5:52  Signal: 168 - Update DB: OK
-Found BTLE: DB:E5:0E:C0:41:84  Signal: 167 - Update DB: OK
-Found BTLE: DB:E5:0E:C0:41:84  Signal: 168 - Update DB: OK
and ofcourse live display of signal level on my public website under BTLE beacon tags (if beacon is not saw last 5 minutes it's gone, or battery is empty (normally will last 1 year or so))

the system is at the moment very new, as as far as i know it's not integrated in any current domotica system, so it looks like you need to develop it yourself like i did, or wait till it's more polular :)

Re: Best way for presence detection with smartphone?

Posted: Sun Nov 23, 2014 10:34 pm
by ThinkPad
I have now disabled the wifi script that i was first using.

I bought the premium 'geofence' add-on for Dromotica (Android) and Pilot (iOS) and tested them today. I wrote down the time when my girlfriend and i left the house, and when we came back. Checked those times in Domoticz, and they matched. So i guess it is a good way to do presence detection 8)

Re: Best way for presence detection with smartphone?

Posted: Thu Dec 11, 2014 2:42 pm
by ThinkPad
For my Android phone (LG Nexus 5) i returned back to the WiFi script. The app did work fine, but when i left house my phone went into a state where it had no data connection (transition between WiFi > mobile connection). This is some kind of bug of my phone i think.

The WiFi script works fine for my phone, detection is very accurate. Lights turn on when i am at my frontdoor, and turn off when i am outside the range of my router for 3 minutes (timespan configurable).
The Pilot app on the iPhone 4S of my girlfriend works excellent.