GeoFence using Homebridge

Who knows better than you, where you are?
If you have an iPhone, the answer is Apple.
That got me to thinking.

If I can port my presence virtual switch to HomeBridge, then that will be a better than the HE presence.
I tried it and it works much faster than HE and seems to be reliable.

This presence virtual switch turns off my HSM when in range and vice-versa when I leave.

That got me to thinking more.
At 72 and living alone, I've shared my location with my loved ones on my iPhone.

I've also bought an AirTag to put in my truck. AirTags are a neat, simple and cheap ($29) item that uses the Apple network to report last known or current tag location if an Apple phone (with location on) is within it's Bluetooth range, even if it's not officially connected to that phone.

Then, in the same vein of my security, I set up a "panic" virtual switch, to be shared with Alexa, so I can tell "Alexa, panic". Hubitat sees the switch turned on and sends texts to those loved ones to

  1. Check my location.
  2. Give them my local sheriff's phone number and/or neighbor's phone for a wellness check.
  3. Give them the garage door code so nobody will be breaking doors down.

By looking at the location of my truck and my phone location, they can determine if the situation is at home or not.


I have been wanting to use my airtags as presence device in hubitat. I looked up a bit and found that a number of solutions on github that pull the data thru the find my network (using a mac), some even can interface with home assistant. However, I couldn't find anyone who publish anything to interface with hubitat. Potentially one can do it with http endpoint? I am not tech savvy enough but I'd hope someone in this community can pick this up.

I guess you're using the Mac as a hub?
If so, you'd have to leave your Mac on all the time (from what I understand).
The AppleTV device or Apple HomePod are the only "Geofenceable" devices I know.
Also, if the device (such as the AirTag) is not close (30 ft max) to an active Apple iPhone or iPad, you're not going to get a signal or location from it.
A HomePod is $78 and will handle the geofencing.

Just visited Apple site... says only AppleTv, HomePod, and IPad are supported as a home hub and you'd have to be running the FindMy devices app running.

In other words, I (not an expert) don't think it's viable.

I bought a homepod mini just for geofencing but it's too slow to trigger with the apple watch so it's useless for my use. My kids ride home with others with iphone so I can see on find-my and track them all the way home with an airtag but haven't been able to find a way to use that to automatically trigger presence in hubitat.

I see several projects on github that people dump find-my data on to a mac, but I have no idea how to use it as a geofence trigger.

Cellular iWatch?
Not sure about your "too slow" comment.
It should report just like an iPhone if your cellular coverage in your area is decent.
My geofencing reports home/away as I get about 400' from the house.
It should have nothing to do with the HomePod or the watch.

True for me as well. The Apple ecosystem 'starts' detecting the geofence 300-400 ft from my home, which is easy to tell when walking. But if I'm in a car or on a bike, I'm quite a bit further in before I get the notification. I have a couple AppleTV and one HomePod that is currently the primary.

Yes, apple watch with cellular standalone, my kids don't have iphone. The watch as far as I can tell react very slowly with location. They usually have to stand outside the house to 3-5 minutes before apple home decide they are actually home, which is definitely too slow. It's obvious on the find-my too. I can usually see their airtag location real time because it's connected to other people's iphone. But their watches sometime don't update locations for hours. I thought it's because apple watch has more aggressive power saving that causing it. If there's a fix to it I'd like to know. Thanks.

Yep, looks like there's a problem, looking at their community:

"My wife and daughter, both runners, have Apple watched with LTE. Ever since they got them, when they’d go out for a run and leave their phones at home, Find My realizes this and starts updating their location based on the watch. Lately, this has stopped working. The watch location is only updated when it’s on WIFI or when it’s near the phone. If I look under the Find My Devices tab, the watch location shows up as the last reported location when it was on WIFI or near the phone, and the information box says “X minutes ago” instead of now. It will stay this way until they come back and get near their phones. They have Apple 4th Generation watches, and an iPhone SE (2020) and a 12 Pro.

Like I said, it worked fine before. Tried rebooting, doesn’t fix it."

That was posted in November last year...

Check "battery saver" setting on the watches.

Thanks for confirming the problem. This is the reason I am thinking if there's a better way to trigger when my kids get home.

Check to see if the battery savingsetting is on (if there is one).
Low power mode should be off.

I've given up on automating presence. What my wife and I do is run a shortcut on our watch when we leave or arrive. Works immediately. "Siri Home ON" or "Siri Home OFF"

Might could use the wifi presence device driver in Hubitat for the watches or the network change.

Reading more on Apple community:

Do your kids watches have the Home app on their watches?

If not,try that.

Yes. Wifi presence is the best solution so far, but it's not automatic. It seems like my kids have to remember to wake the watch for it to connect the wifi network. Sometimes it'll take a minute of so, which isn't too bad compare to other methods I have tried so far. I was just trying to see if there's other way (Like the airtag location in find-my network) that I can get a geofence to"look ahead" a little.

Did you see my question about the "Home" app on their watches?

Yes. Home app has been running on their watches. I don't think it worked at all if it's not on them. Thanks for checking.