Steven M Castano Posted February 6, 2013 Share Posted February 6, 2013 I had read a few threads on here about proximity detection of sorts.... basically wanting to know if someone is at home or isn't. So, what I've been working on is trying to figure that out.... And short of embeding an RFID chip in my arm, or trying to strap bluetooth hardware to my ankle like a house arrest band... I was thinking of what we all carry with us the most, a cell phone!! Mine happens to be an iPhone 5, my girlfriend has an iPhone 4S and what I've figured out so far is that both phones have a network feature for "usbsync" and "lockdownd" which leaves TCP port 62078 open. Since the devices won't respond to ping all the time, I decided to see if they would respond to a TCP SYN (the part of a network transmission that checks to see if a port is open and responding) and sure enough, it does! So, now I know I can set up monitoring (which I've done on http://www.monitor.us) to check that TCP port on my phone through my home router all the time... if it finds it, I'm home.... if it doesn't, I'm not!! Now the question is... is there a way to do this with a timer, network resource, some kind of API or other method I don't even know about on my ISY. Or even if I use a linux server to do the checking... can I use curl or something to fire off a program on the ISY via my network also? It seems like using the TCP port checking method should give me a pretty good idea of when either my own, or my girlfriends, iPhone is "home"... this way I do do things like turning on the lights, but only when nobody is home. Turning OUT the lights 30 minutes after the last one of us leaves, setting light preferences based on which one of us might be home at that time... etc.... What do you guys think? Any ideas? Link to comment
Xathros Posted February 6, 2013 Share Posted February 6, 2013 I do this by scanning the ARP table on my router for specific mac addresses and update variables in the ISY based on the results. Works pretty well but I have found that the iDevices tend to come and go frequently (to conserve battery I'm sure) so I have had to build in delays to prevent actions based on disconnects for 5-10 minutes to ensure a device has actually left (or run out of battery). -Xathros Link to comment
bsobel Posted February 6, 2013 Share Posted February 6, 2013 Im in the middle of a project to do just this and plan to make what I'm working on available in one form or another (software only or maybe a full device). I'm do this on the Raspberry Pi platform. I currently configure the system with the either/or the bluetooth and wifi MAC of the devices I want to track. It does both bluetooth queries as well as arp queries to determine when someone is around. I tie that to the ISY via variables (e.g. I can say if this device is found via either arp or bluetooth then set an ISY variable to X) or I can count the number of 'unknown' bluetooth devices and set another variable (I use that so the house knows if I likely have company or not). I'm hoping to play more with Bluetooth and get range information, I'm thinking of a model where I'll have 4 of these in 'areas' of the house and I can get an idea of not only who is home but what zone they are likely in. If you don't want to wait for what I'm cooking up, I'd suggest getting a Raspberry pi youself to play with, great little addon for the ISY if you think of it as a slave device to the ISY. Link to comment
Steven M Castano Posted February 7, 2013 Author Share Posted February 7, 2013 There are all great tips... I was working on doing this for the last few days via the port checking method and found the exact same thing over WiFi, that the MAC didn't stick around for very long, nor the port that I was check. Xathros, I'd love to see the script/logic you're using to do your checking. Also, how are you guys updating the variables? Is it through the API? Are the good docs on putting this together, I couldn't seem to find much out there. Also, do either of you have any good ways of using incoming emails to trigger these same changes/updates? I've been playing around with "Find My Friends" on the iPhone and it's great!! It will send an email to any address I want when I arrive and/or leave a location and from my testing it seems to be VERY accurate. This would eliminate the constant "polling" that needs to be done for MACs, IPs, Bluetooth connectivity, etc... It also won't change anything to "Out of the house" until the GPS actually senses its outside and not in range. It should signifcantly lower the amount of work the home server would have to do and potentially eliminate any additional servers/hardware we all might be throwing at this. I've been looking at using sites like tarpipe.com of IFTTT.com to process the email and have it execute an API call to my ISY when needed. BOOM.... home automation and the ISY "in the cloud"... all us nerds bosses will LOVE that one! Link to comment
Xathros Posted February 7, 2013 Share Posted February 7, 2013 This is how I got there: viewtopic.php?p=74728#p74728 -Xathros Link to comment
Recommended Posts