Presense Detection using DHCP and ARP ping

Before switching to Hubitat I had played around with Hass.io and OpenHAB. Both of these systems offered similarly creative solution to presence detection that did not require any mobile app. I would like to request a similar capability in Hubitat as it worked very reliably for me in OpenHAB. Here's a link to the OpenHAB docs that describe it:

It basically works like this:

1.) OpenHAB listens to port 67 for DHCP requests. Any device that is connecting to the Wifi network makes a broadcast to this port asking for a DHCP address. the DHCP server responds by broadcasting the assigned IP back to that device as a response over port 67. That means that any device on the network who is listening on port 67 can effectively "watch" for new devices connecting to Wifi and know thier MAC address and IP.
2.) If OpenHAB sees a device that's been configured to recognize (IE: The MAC address of my phone or any family members phones) ask for an IP from DHCP it knows that person has just arrived home. So this gives you an "arrival" event. It also tells us the devices IP address that we can continue to ping to see when it "leaves"
3.) Every X number of minutes it pings the device to see if it's still around. (This requires disabling the wifi sleep for your Home Wifi network on your mobile phone). if the device fails to respond to at least X number of pings then it's marked as "Not present" and can trigger automations for when you leave.

The only drawback to this approach is you have to configure your device to "Keep Wifi on during sleep" which can lead to slightly higher battery usage... But still a lot less battery than what Life360 would use constantly pinging the GPS sats.

This sort of DHCP and ping based presence detection worked well for me on OpenHAB and I think it would be a welcome addition to Hubitat's rich feature set.

I could implement this myself if I knew of a way to access such low level libraries from within Groovy to listen for DHCP requests and make ARP ping requests to specific IP addresses. Maybe this could be a secondary feature request to enable more access to direct network capabilities for more customized solutions.

Thanks,
-Jeremy

4 Likes

Although the use of Wifi/DHCP/Ping works for a small area it can't encompass a larger area to cover the most common Geofence/Zone use cases of being

  1. Open/Close the Garage Door
  2. Disable/Enable Alarm system

The first item needs to be triggered well before the phone is generally within Wifi range of the home. Unless you have some crazy Wifi amplifier setup then it may work. I would hope your network is secure so the people the next block over aren't enjoying your Wifi :slight_smile:

The second can work with the Wifi solution as this could be triggered from feet outside the front door which in most Wifi scenarios would have signal.

Life360 is a good system, it's just not reliable as the mobile app tries I think too much to conserve battery and tries to be too smart about retrieving/sending location data based upon movement. Sometimes this works well and other times it fails completely. This is also based upon the make/model of phone too. I have tested Life360 a lot and other mobile apps and I have found none of them to be perfect not even the ones I support.

Another issue with having a phone based solution is that each phone has to be touched and configured properly and you have to get the MAC of each phone and manage that list and if someone changes phones reconfigure. Not a huge amount of work but trying to get a phone from your Wife or teenage kids can be a challenge. The work around to this is an app that supports remote configuration. This way you can manage the configuration from a central point and pull/push the configuration to the phones anytime.

Largest issue I see with this is there's no access to the low level networking of Hubitat. You can't even assign a static IP address there's no way they will give direct access to run a network sniffer to be constantly listening for DHCP responses.

This would work great for me. I run a Unifi network with a secure gateway and multiple access points, I even have external access points. I know every device that tries to connect including Glen's chevy as he drives by. I have a separate network for guest devices to get internet.

Yep, it sounds like a good managed solution for handling fairly generic “presence”.
I’d use it. :+1:t2:

Can the iPhone 'Keep Wifi on during sleep'?

Nope. iCraps (TM) (C) sleep soundly!

The WiFi (be that MAC address or ping) detection method has always failed for Apple devices. The Asus router methodology I use had to be adapted for up to a 10 minute "non-response" time before it was marked as "away". This causes issues for any implementation that is dependent on Apple presence as a 10 minute delay is a LOOONG time!

I currently use a hybrid system that has yet to fail me (OK, 1-2 a year!)

  • ST presence
  • Life360
  • Wi-Fi
  • IFTTT presence

Any 2 & you are considered home.

J

1 Like

"Although the use of Wifi/DHCP/Ping works for a small area it can't encompass a larger area"

This is absolutely not true. I live in a neighborhood where there are a dozen homes each on lots ranging from 5 acres at the smallest to 10+ acres at the largest. If 5-10 acres doesn't count as a "larger area" I don't know what does.... And I can easily pick up all of my neighbors wifi signals at my house. My phone is almost always connecting to my Wifi by the time I turn into my driveway and the connection is established well before my car reaches my garage door.

"Unless you have some crazy Wifi amplifier setup then it may work."

I do not, nor do my neighbors, yet it still seems to cross our property lines. I can access my Wifi from anywhere on my 5 acre property and even from my immediate neighbors properties.

"I would hope your network is secure so the people the next block over aren't enjoying your Wifi"

Umm, duh? I don't know a single person who can't pick up their neighbors wifi signals in their homes, except my parents who live on 200 acres, and even they sometimes pick up weak signals from their neighbors.

"Another issue with having a phone based solution is that each phone has to be touched and configured properly and you have to get the MAC of each phone and manage that list and if someone changes phones reconfigure. Not a huge amount of work but trying to get a phone from your Wife or teenage kids can be a challenge."

What "presence" detection system doesn't require "touching" the actual presence sensor and configuring it somehow? I can't believe you're arguing against a Wifi based presence system because it requires touching the phone. So does Life360 as it requires installing an app on the phone, one that is far more intrusive from a privacy perspective. If you're claiming your wife or teenager won't let you see their phone long enough to change the wifi sleep setting or grab the MAC address.... how are you convincing them to let you install an app that tracks their location 24/7???

Furthermore: Mac based presence actually does not require touching the phone (Aside from maybe changing the Wifi sleep settings if needed) as you can get the MAC from the router itself, or using the ARP command on any PC on the network. I was able to do this in OpenHAB by simply letting OpenHAB scan the network for MAC addresses and it did most of the work of identifying which MAC was what. The first half of a MAC address identifies the manufacturer of the device which is often enough to determine what phone it is, or just compare scan results when people are home vs away and see what MAC addresses show up/leave.

Again: This is how OpenHAB does presence detection and it worked well for us on that platform and it seems to work well enough for a ton of OpenHAB users who use this every day. So I don't really understand why you're claiming it wouldn't work well on Hubitat. Sure it may not work perfectly well for everyone but there is no such system that would. This would be a huge improvement over Life360 which is the only "out of the box" mobile phone based presence detection system currently supported by Hubitat.

"Largest issue I see with this is there's no access to the low level networking of Hubitat."

... That's why I'm posting this to the "Feature Requests" section of the "Support" forum... The guys who actually write the firmware code for Hubitat do have access to low level networking code and could very well implement this feature, especially if enough people ask for it. If I had low level networking access to the Hubitat device I wouldn't be posting here asking Hubitat to implement it for me, I would just do it myself. (Which I'm currently working on doing, but using my Linux server to listen to DHCP requests and make pings and then make HTTP GET requests to Hubitat to update present / not present status.)

That's great. I live on 5.5 acres and standing in my driveway my phone doesn't see anything but my network. Now there are times weather is right or the Moon is aligned there's blip of a neighbor that shows up. But I also know from my experience of using the Wifi method with Home Assistant that it works... sometimes but not always as even with my standing at my mailbox I have poor signal and worse and worse.

Experiences are different. I Live in a heavily wooded area so that does affect things as well. The point is that it's hit or miss. For everyone on the OpenHAB and Home Assistant communities that have great success there's a amount of failures as well.

Well.. now you do. I can't pick up my neighbors.

Life360 is very easy to setup. You send them an invite and they install and done. Great system actually. I have used it a lot and still do but not for important things. The app setup is great. Other apps do require more "touch". I'm not arguing. I didn't claim they won't. I said it is a challenge to get their phones to do such work on.

Again, yes it works great for many and not so good for others. To each their own. I didn't claim it wouldn't work well on Hubitat just that it can't work today which leads to your next paragraph

Yes Hubitat has the ability to implement. I hope they do.

If you're using an EdgeRouter, here are some scripts that will give you presence based on ARP table info: ARP Presence Sensor