Geofencing ... So Is OwnTracks the solution now?

You might think about adding a 'presence limit' as Geofency calls it. It's the same idea except for presence. Think about driving around the block and not wanting to set off the 'arrived' event.

Doesn't the 'delay away' solve that? If I drove around the block, well, biked, since I don't drive... but if I biked around the block with it set to 5 minutes or 10 minutes, so long as I'm back within that time I won't be marked away at all. So there's no 'arrived' event since there was never an 'away' event.

I also use the http presence webhook helper app with my 'less than binary' virtual presence switch, which probably does whatever 'presence limit' on Geofency does.

1 Like

The ideas certainly can overlap. You can have a departure delay of say 2 minutes. On your route you go to a neighbor's house and then pass by your house 10 minutes later on your way to your ultimate destination. You don't want the 'arrived' to trigger just because you go past your house.

Yeah, that's the sort of thing my 'less than binary' virtual presence sensor covers. It has "just departed", "just arrived", "extended stay", and "extended away" settings on it.

So if you have something you don't want to trigger over and over, you can put in a "required expression" for "extended away = true" and it won't trigger unless you've been away for long enough for "extended away" to be on. I have mine set to 3 minutes for the "just" ones and 30 minutes for the "extended" ones, but they're configurable. Or set a required expression for "justDeparted" = false, and then it's a shorter time you need to be away before triggering your Rule.

I use this for things like auto-unlocking my front door, but only if I've been away for long enough to not be "just departed". This way if for some reason my phone GPS goofs up and sends an update with me outside of "home" then next update sends the correct location (which hasn't happened on iOS, but used to happen a lot on Android), then it won't unlock the door. I've also got an enclosed porch with a door on it, so my "auto-unlock" logic is this:

Feels like a decent balance of not unlocking the door if I'm just passing by (which really doesn't happen when you're walking or biking everywhere anyway) with convenience. Plus, locks are just to keep honest people honest. The front door is 80% glass. There's two 33x60 windows on either side of it. There's 11 more ground floor windows. There's an old French door onto the back patio that's probably 90% glass. If someone wants to break in they can break in.

2 Likes

Hi, So I was able to set up automations using your virtual presence driver. Few things I noticed and may need help with :

  1. I ended up using Makers API since I am already using that but while trying to setup your HTTP presence app, I noticed the webhook showing on app is calling "arrive" or "depart" commands while it should be "arrived" / "departed"

  2. The screenshot you posted is that a personal automation ? It does look like HomeKit Automation but when I was trying to set it up I am not able to see shortcuts from available actions. How did you set that up ? I am on iOS 17.3

  3. Setting it up through personal automation was annoying since I had to set up geofence for every single instance that is for 3 family members, set up geofence 6 times,

  4. Also another annoying part is when using personal automation for arrival and departure, a notification popup telling a shortcut just ran.

I'll continue testing but so far in couple of arrival/departure events it seemed to work fine.

Thanks.

Not sure why it should be arrived/departed. The web hooks are whatever I want them to be. They just serve as an entry point into the app code when they're called, and they're descriptive enough with 'arrive' and 'depart' to know which web hook to GET when you're arriving or departing. If anything I could change it to "Arrives" and "Leaves" to match the wording on HomeKit.

It's in HomeKit. You have to have a physical HomeKit hub of some sort to use it. That can be an Apple TV box, any of the HomePod speakers, etc. Then at the very bottom of the "Select scenes and accessories to automate" window, there's an option to "Convert To Shortcut" you can select:
image

On that you can select "Get Contents of URL" as the shortcut action and provide either the arrive or depart webhook depending on whether the HomeKit automation is for "Arrives Home" or "Leaves Home"

For points 3 and 4. Again, you need a HomeKit hub. Otherwise you have to set up a bunch of personal automations, AND they pop up an annoying "blah blah automation ran" notification every time you cross the geofence, and you can't disable that notification.

You still need a pair of automations per person on HomeKit hub, but you can make them on a Mac quite a bit easier and faster than on a iPhone, and you don't need to make them on each and every device. Just a central location via HomeKit:
image

If you don't have a HomeKit hub, I can solidly recommend the latest Apple TV box. It's blazingly fast. Not filled with a million ads and other BS like Google or Amazon stuff is, and isn't nothing more than a glorified data harvesting box like Google tv or Amazon tv.

First of all, Thanks for the details, I saw the "Convert to Shortcut" but didn't realize that there was an option to change the shortcut to call for webhook. It's all good now. I can set them up from my phone now for everyone in the house and Yes I am using Apple TV for Homekit server.

Also sorry for Point 1, I didn't really mean "it should be"....unless I missed something I realized your device driver code had commands defined as "arrived" / "departed"

While the webhook URLs generated in the App have commands as "arrive" & "depart" I guess those need to match with commands as defined in your driver code.

Ah, I see what you mean.

So there's these mappings:

Those determine which method gets called when the webhook is hit.

For example, the arrive one calls p.arrived() on each presenceSensor p.

So what needs to match is p.arrived() which indeed matches with what's on the presence driver:
image

The actual mapping path isn't important at all.

I could change it to this, and all that needs changed is the URI of the webhook in the HomeKit shortcut:

That's the only place where 'arrive' matters, is in that URI. I could change it to arrived, but that would mean I'd need to change all my HomeKit shortcut URIs and so would anyone else using the app... which is definitely not worth the trouble.

It was just a quick app I tossed together in like 15 minutes a couple years ago to (at the time) make up for the lack of HomeKit integration with Hubitat. Now I keep using it because I've had some trouble with things saying "not responding" here and there.

1 Like

Ah, I see. That makes sense. I was just checking the webhooks by pasting into browser to see the changes in device status that's when I realized device attributes are different. I didn't realize app handles the commands at the backend. Sorry not a programmer so forgive my ignorance :-).

Thanks Again for your help. Set up was easy enough. Will be testing for next few days and will see how it works with Homekit geofence I am using Owntrack - MQTT set up and without regions for a different purpose so can't really use that here. Hopefully homekit setup will serve the purpose,

No worries... that's why I took an extra minute to explain it.

I think you two need to get a hotel room... :wink:

Hi Daniel, So far I have found Homekit location triggers quite responsive. However since my home boundary is right next to the road when I come back home with 330 ft default radius set by homekit, I enter and exit the geofence for a short period of time before finally arriving home. Ideally I can set a different geofence in homekit but then it won't allow me to use that geofence for other people or even other automation for myself. I'll have to create each individually again. Anyways bottom line is I figured there is about 30-35 seconds gap before exit and entry into my home geofence so I had set 1 min delay "Time before processing Departed event" but seems like that delay didn't occur based on the following timestamps

There is only 5 seconds gap between arrive / depart events at 5:29

Did I miss anything in the set up.

Also, one request, is it possible to define numerical duration for event delay instead of having a fixed value from drop down menu. For example lets say I want to have 40 seconds delay.

Again. Thanks a lot for your help.

ha ha I think a bar would be better to hangout...

1 Like

Has Owntrack affected the battery life? Worst than life360?. I like the accident notification Life360 has so was planning on having the rest of the family run both. But, concerned about battery life.

I've had zero issues w/battery life related to using the new OwnTracks integration, battery life has been indistinguishable from before.

3 Likes

I am still running both side by side and haven't noticed anything out of the ordinary.

I liked the accident notification too (from experience it works well) but will most likely still dump 360 because of the way they handle user data.

1 Like

Just thought I add this...but probably a little tough on a bike.

I use a Feasycom USB beacon in each car with geofency reporting both the presence of any one of those and my geofence as well. If both are not active rules are set up not to run. That way when I go for a bike ride or a walk my rules don't trigger accidently...no matter how long I'm gone. I use another USB beacon to lock/unlock the front door when I leave, or I come home from a walk and the house is in Walking Mode.

I used to have keychain Bluetooth's beacons that I used for presence, with a couple ESP32 for “listening” for them. It worked well until I got new locks. Now I have a hidden key for backup and just use the pin pad (or auto unlocking via Hubitat) and don’t carry keys outside the house.

But yeah, if none of the ESP32 “heard” my beacon it was almost assured I wasn’t home. And if they did it was 110% for sure I was home. Only a dead battery could mess it up. Worked great.

But now I don’t carry keys and I’m not buying a beacon bracelet, or wearing one.

Ya, all mine are plugged into wall outlets and car usb power ports. My phone with Geofency reports when they are in range to Hubitat.

The ones in the cars are only on and in range when the car is running. That way I have to be in range of them ...IE Me in the vehicle with my iPhone and AND enter or leave my Geofence to trigger my rules.

I like the double-check before anything unlocks.

That pretty much defeats the entire point of BLE beacons IMO. You're sitting on a single point of failure, your phone. The reason I had a couple ESP32 'listeners' was as long as a single one of them heard the beacon I could be marked as 'home'. If my phone was off I would still be marked as home since the beacon and ESP32 had no dependencies on my phone. If one of the ESP32 were offline or down for some reason, there were a couple others around the house to pick up the beacon. It was really really solid.

The only real point of failure was a dead battery in the BLE beacon. I even worked around that by just tossing a second BLE beacon on my keychain so even a dead battery wouldn't result in me being mistakenly marked as away when I was actually home.

So a 'false away' would require both beacons having a dead battery at the same time. A 'false home' was literally impossible, short of someone spoofing the BLE broadcast MAC, which while possible, just isn't something someone is going to do. Someone breaking in to my house is gonna use a brick through a window, not sit out front in a van scanning BLE MAC addresses to find the one on my keychain and spoofing it after I leave. That's just not something that's ever going to happen.

I really hate relying on my phone being the sole way of knowing if I'm home or not, but it's the only thing I reliably carry with me every time I leave home these days. 5 years ago I didn't have PIN-pad door locks so I always carried my keys 100% of the time I left home, making a keychain BLE beacon a great solution. I should probably look around to see if there's a solid, reliable, BLE beacon that's thin enough to fit behind my phone inside its case. Tile Slim almost fits the bill but it's a bit too thick still and now that Tile is owned by Life360 they can F right off, twice. I'll never have anything to do with Life360, they're AWFUL.