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

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

I agree with you. A lot of the custom apps I've written have been to deal with unreliable devices and put them behind an abstraction that solves the reliability problems. (For example, see my app "Reliable Locks")

For the same reason, I've put a LOT of time into my tools for solving presence.

If I were dictator of the world, the Hubitat company wouldn't spend any effort on their own presence, but would promote and publish info on other presence integrations first.

But... as my wife would tell you... I am not the dictator of anything. :smiley: Aw well...

That said, I think they've done a pretty good job focusing their efforts on high ROI items. Recent example: the HomeKit integration. When they first released it, I didn't use it. Figured I've already got HomeKit working using HomeBridge, so why change? Well, I did gradually switch over to using the native integration. And it's faster and more reliable than HomeBridge. And I don't have to keep that Raspberry Pi running anymore. Very nice improvement!

4 Likes

I agree with this completely. Especially because there are a number of such integrations that work well (Apple Home, OwnTracks, Geofency, Locative), some of which are cross-platform (OwnTracks).

1 Like

I vaguely remember the mobile app announcement and it's privacy claim. Hubitat does not know your location, all they get is a 'present / not present' message. If that's still true, then there's nothing Hubitat is able to fix. Yes they can protest with their partner, but the fix is "over there"

I know that I use Apple's presence and that all my hubs see is that switch that's part of the "Presence plus switch" driver we use. If Apple can't provide 100% to me, I can't try improving the driver... there's nothing to be found down that path. I am getting 99% out of Apple, so I can't complain, much. I will say the variability on detecting is pretty large. I get the notification on my watch and notice where on my street it arrives.. it's all over the place :smiley: Sometimes down by the corner (very fast response) and sometimes I sit in my driveway waiting a couple of seconds (very slow response.)

Soft disagree on this, having been through the implementation of it in another app. Yes, they're using Apple's geofencing to get "present / not present" messages. However, there are right and wrong ways to set this up in your app.

The wrong ways will give very poor reliability unless the app is open and in the foreground. The right ways will give you 99% reliability. It's not perfect, but it's good. And you're correct that it's a hard limit. (If iOS just decides not to have the gps on for a while when you arrive home, there's nothing the app developer can do about that. And Apple doesn't even promise any SLA for geofencing events. They outright state that it might be delayed several minutes sometimes.)

The real killer is that Apple doesn't document the right ways, and most of the blog posts and documentation out there gives the wrong ways.

1 Like

I have no knowledge of what vendor they use... I've never even downloaded the mobile app.. I'm simply remembering their emphasis on not breaching our privacy. That has to be implemented in only one way.. a switch. The vendor, whoever it is, turns on or off a switch that feeds into the mobile app. I don't see, in this scenario how the Mobile App might be doing it wrong. But one of the big benefits of me being wrong, is I learn stuff. :smiley:

Is there some secret to this you can share?

I've got the latest gen Apple TV connected to a $20 gigabit switch, which also has Hubitat connected to it. This is just a plain TP-Link switch that does ZERO anything other than switch packets. There's no VLANs, packet filters, anything of the sort involved here, so it's not some misconfigured Ubiquiti system causing issues or whatever. It's about as close to plugging the Hubitat directly into the Apple TV box as I can get.

And it doesn't work. Like easily 50% of the time. As I'm typing this I loaded up the Apple Home app so I can get a screenshot. Just waiting on it to time out. There we go:

I've got the little "restart hourly" thing toggled on too:

You should work with @gopher.ny as 'no response' is not expected

Yeah, but I don't want to waste his time. I've got a C7 that I run betas on, and a C8 that's my main hub. When they 'opened up' HomeKit to all devices a couple releases back, I beta tested it on my C7. It had connection issues. I've removed it from my C7 a while ago and added it to my C8. Same issue. Both are connected via wire on a cheap basic Gigabit switch. I'm mostly convinced that even tho I'm running them wired on a basic do-nothing-special switch that there's still something in my network that's causing it, and it's not an issue with the App on the hub.

I do have a very restrictive DNS ad-blocker on my network. Hubitat doesn't use it, but the Apple TV does. Tho I'm pretty sure I've tried putting the Apple TV on 1.1.1.1 and 8.8.8.8 with no change. Plus as far as I know, HomeKit uses mDNS/Bonjour, so it wouldn't be affected by the ad-blocker anyway. And if it were an issue with it being blocked, it would be a permanent issue, not intermittent, too.

I'll raise an issue only after I've thoroughly convinced myself that the issue I'm having isn't something I've caused myself.

Mostly I'm interested in hearing how people who have no issues have theirs set up.

I'm running a basic Asus router too.

Edit: opening a ticket. It's definitely not my network.

2 Likes

Mine are on a UniFi network. Flat topology, IPv4 only. Pi-Hole filtering, 1.1.1.1 DNS. TVs wired, Home Pod Mini WiFi.

2 Likes

I have not made an extensive foray into HomeKit Integration. I put about 10 devices on it initially, leaving the bulk on Homebridge. After the 'open up' release, I went to each of my hubs and added at least one device. It's always worked, or just didn't. No intermittent. Last week, I went through each hub and moved a couple more each and it just worked, I didn't encounter a not work.

In my setup, all my Apple Homekit is on WiFi. 3 Apple TVs and a Homepod Mini. DNS is internal, with malicious site restriction by resolving to 127.0.0.1 but as you say, mDNS/Bonjour shouldn't be affected. I'd say my restrictions are mild in comparison. Looking at Home Hubs & Bridges, I have 5, Homebridge, which still dominates the device count at 56, my initial test Hubitat hub with 16 devices, then my 3 Production hubs with 8, 3 and 2 devices.

All my Apple Homekit (Home Hub) devices say the same: v17.2 and 5g WiFi