Presence sensing sporadic and unreliable; let's please get this fixed

I also have had less than optimal experience with our (2) iPhones for presence and geo-location functionality with both SmartThings and Hubitat. However, once I started using webCoRE presence with SmartThings and now Hubitat, presence and geo-location have worked 99.9% of the time.

FWIW, I have used a purpose-built geofencing app on Android for one year (2019-2020), and on iPhones since then. I cannot recall when it last failed. And, I'm lucky in that Apple Home + Shortcuts has been equally robust.

What I dislike about Apple Home is that I can only set a geofence around my home, while the other application I have lets me set multiple locations, as well as geofences that are concentric circles - which let me determine the direction in which I am traveling.

1 Like

.... and this is my point exactly. Making this work is possible. It's software that we humans write, is it not? And in my case, the Hubitat app correctly identifies when it's in or out of the geofence, just simply fails to send the message at the transition. I know this because I can send it manually with the "Send geo event" button, which works. Looks like a pretty fixable bug to me.

False.
I have 3 set.

During the creation on an Automation, you are able to pick a Location and create a new one by typing in an address.

I was so astonished by this when I first found out (here in this Community, years ago) that I set a geofence around my kids school. Useless because I already know when I'm at their school, but it was fun to view on a dashboard.

1 Like

Nice! Learn something new every day!

One of my jobs is as an iOS engineer, and it sometimes involves tracking location and using geofencing. There are a few things to know, if you want to understand why it doesn't always "just work".

  • Using the GPS sensor is EXPENSIVE. In energy usage. If an app tried to track GPS 100% of the time, the battery would be depleted at an outrageously fast rate.
  • Because of this, iOS and Android only allow app developers to use GPS, and run code in the background as a result, in very specific conditions. And only very limited times. And if you "misbehave", they just kill your app and you get zero processing time.
  • Okay, so why not just do that? Follow the documentation and do the allowed GPS and background processing? Well... neither Apple nor Google like to document exactly what their "rules" are. Because if they do, malicious actors will take advantage of it. So the rules are left undocumented, and only companies who are willing to make the long-term investment to discover the rules, follow them, and then update their usage as the rules silently change... only those companies will be able to track location reliably.

Based on my experience working on similar apps, it looks like Hubitat's app doesn't 100% follow the undocumented rules, and is thus not being granted enough background processing time by iOS. It works when you open up the app, because apps in the foreground are given all the processing time they want.

Honestly, I understand why Hubitat hasn't fixed this. It would be a large ongoing investment. I'd personally prefer that they prioritize other things. And I've prioritized other things by using other methods for tracking my presence.

Important: I have no knowledge of the internal business of Hubitat. Everything I've said is my guesses based on my experience, and the conclusions are only my own preferences.

Edit: Oh, one more thing. Part of why this is so expensive to engineer. It's not just an undocumented process. It's that testing is expensive. It takes a lot of time. You have to actually go driving and see if the geofences get hit. And just because it gets hit once, doesn't mean it will every time. You might find that it works fine for a couple days, but a couple days later, iOS decides that you're using too much battery and stops giving you geofence events. It is DIFFICULT to test.

15 Likes

Well said!

2 Likes

As has been discussed many times here, presence sensing is not easy! I use multiple geofence and WiFi sensors with the Combined Presence app. I would like to understand how the hub processes presence events so I can make the process more reliable.

I am presuming that the hub only generates an event when the state of the device changes? For example if the state of a phone device is "not present" and the phone comes home but it misses the geofence event. Then the next time it departs and sends the "departed" message there is still no hub event because the device state has not changed?

If so wouldn't it be better to manually set the phone state to "present" using a reliable (Wifi?) sensor. Then the hub would generate the departed event when the phone sends the geofence event?

1 Like

Presence sense and door/window Contact sense are more or less the same to the hub.

A sensing device sends a message to the hub and the hub "translates" that into an Event. Presence yields events that are "Present" or "not Present" while contact sensors yield events with "open" "closed". In other words, each device has a specific set of Event contents.

I myself use Homebridge to send a Presence plus switch into HomeKit. I have an Apple Automation track a geofence I created and set the switch accordingly. On Hubitat then, I see Presence track the iPhone.

Your idea to use multiple overlapping mechanisms to increase the certainty is commendable. I happen to use 3, including WiFi and a Zigbee fob. The fob is the least trusted because it's battery powered and can die.

Many thanks for the reply, can we dig one level deeper into the generation of an event.

Let's assume a phone device is really at home (present) but it did not send its "arrived" message, the device state will still be "not present". The phone now leaves the home and sends a "departed" message. Does the hub still generate a device event because it received a "departed" message or does it ignore it because the device state has not changed?

My educated guess is no event is triggered, but you can easily test this my looking in the Events section for your phone Device on HE. If you have had a situation like you describe and you don't see an Event recorded then you are correct in the second part of you question. Along similar lines, but really just testing the same thing, you could setup a rule to be triggered by changes in presence and simply log a message in the logs.

This.

The Hub will not usually duplicate an Event. There's de-duplication logic in the hub for this.

If you're actually seeing that behavior, it would be intriguing.. I've been using HomeKit Presence for several years and I've never had a reason to go look for a missed change. Remember, in this discussion, virtually nothing is occurring on Hubitat. The iPhone is sending geoEvents to Apple. Apple has the GeoFence parameters. Only when the iPhone passes outside the fence then back in again is a "present" detected and that, for me, flips a virtual switch to on. When the iPhone is inside then goes outside the fence, a "not present" is detected and flips the virtual switch to off. The virtual switch is on Hubitat, but the communication between Apple and Hubitat is over the internet (via Homebridge in my case.)

When I say: "virtually nothing is occurring on Hubitat" I mean nothing remarkable. It's getting more or less the same Event as a door sensor.. or when someone flips a wall switch.

I do use an iPhone but not with Homekit, I have three geofence apps running (. . . its a long story!) of varying reliability from sometimes missing an event to sometimes registering an event. So I know all the iPhone apps will miss a geofence event some time but I am hoping that it would be rare for them all to miss an event at the same time.

Furthermore, from this discussion it appears if an app misses one event then the hub will "ignore" the next event from that app because the hub device is in the "wrong" state. If I use a rule to "correct" the phone app devices in the hub on each event then it will correctly sense that missed event.

At least that is the theory!

EDIT: I may have misunderstood your comment, when you say rule are you talking about a rule in HE, or somewhere else? If somewhere else, then you can ignore my comments below.

Unfortunately I don't expect you will be able to achieve this. My understanding would be that the following would happen:

  • As a starting point, you (your phone) are inside your home and HE reflects this with the present status
  • You leave your home and for some reason this is not communicated to Hubitat, so you are still showing as present in HE
  • You return home and a GeoFence update is sent to HE to say you have re-entered your home. At this point HE will assess your (your mobile device's) current state. Since the device is already showing as present, no Event will fire in HE because there is no state change. This means no rules that are triggered on presence changes will fire either, so if that was your intention, then I don't expect you will be able to configure a rule to detect a "present" GeoFence update while the mobile device is already reporting as present.

That is at least my understanding of how it would work, but still worth testing it out to be sure.

I'm also not sure what you mean by correcting the devices, if one event is missed and the next one reports the same state, then there is no real correction to be made at that point... Is there?

@sburke781 . I think we are saying the same thing about how the hub responds - it will only generate an event if the state of the internal phone device changes.

Lets assume there are two inconsistent geofence Apps A & B. The hub correctly reports them both as present and then the phone departs.

  • Assume App A misses its geofence "departed" event so the hub device still sees it as "present".
  • Assume App B correctly registers its "departed" event and the hub changes the device state to "not present".

The phone now returns home:

  • Assume App correctly sends the geofence "arrived" event but the hub sees no change in the device state.
  • Assume App B now misses its geofence event so the hub does not see any change in its device state.

In this case there is no hub event so there as there is no change in either device state. However if we manually sync the device states on the receipt of any App geofence event, then both Apps would have to fail at the same time to miss the event.

I don't like to keep location on.
I've used SmartThings arrival sensors successfully, but they eat batteries.
Some people have added batteries and someone made a custom device.
We've been using the iPhone presence sensor driver on our Samsung phones lately.
I think notifications "on" for wifi networks available helps, but not sure. Haven't noticed the 'sleeping' thing.
Still getting used to it.
So far, pretty good. Kudos to the developer.

Ah, I see, you will use the state of a second HE device to adjust the presence of the mobile device in HE.

Yep, I have three geofence apps so the theory is a geofence event from the phone is always correct and all three apps are unlikely to all miss the same event.

Thank you for the information about Geofency. I’ve been trying to get geofencing to work for a long time. Geofency actually works!

OP here, and I appreciate your perspective.
Personally, I want home automation to be reasonably reliable. I suspect this is true for most.
(and I greatly appreciate that, for the most part, Hubitat is)

I do not understand the rationale behind a feature that's inherently UNreliable. Seems to injure the brand. I feel bad for any new buyer that sees presence sensing as the trigger to buy Hubitat, only to encounter all the excuses why it doesn't work.

1 Like