[RELEASE] Combined Presence

Yeah, they do different things. My Wifi presence is basically "pinging" your phone. Homekit is doing some proprietary, secret Apple thing which appears to be a combination of geofencing and wifi pings, with some weighting.

But they aren't they both dependent on the mobile device being on the LAN, and therefore redundant? i.e. if my Homebridge/HomeKit presence detection is functional, do I need Wi-Fi presence?

Yes and no. I've had times where HomeKit was slow to detect an arrival (maybe because it was waiting for a geofencing update), but the Wifi presence detected it faster. That's why Combined Presence thinks in terms of arrival/departure events, rather than trying to combine present/away. It's to get the fastest response possible, by watching for arrival/departure events from multiple types of presence sensors, knowing that they have different performance characteristics in different situations.

My understanding from Apple's documentation is that Homekit for 100% sure uses geofencing. I believe it's possible they use wifi also, based on its behavior. But they keep the combination as a secret sauce.

If I wanted to create more than one Advanced Combiner for the same virtual presence sensor, what should I do?

Will adding a second instance of the Combined Presence app muck up my existing one?

The app should create children for each new instance, so I wouldn’t expect you need to create the parent app again. I have done that for other apps though and can confirm it works.

That said, are you planning to use different source presence sensors to separately impact the same target virtual presence sensor?

It should work, but I’m curious as to what is your use case...

I now see where I can click on the parent App and create new Combiners. Sorry, long day.

Just trying different combinations to get presence to work correctly.

Not sure if it's because we have old phones but presence is slowly making me go mad...and not in a cool evil scientist way. Like, the bad mad <- changing my screen name (if I ever finish this pooooost).

1 Like

Yea, presence can be problematic. There are quite a few posts on that.

I am personally using 4 presence methods combined into one via this same app to get it to work, and it is now working quite well - most of the time...

  1. App’s presence (works well when High Accuracy is enabled, but that kills my batteries unfortunately...)
  2. Geofency (Paid app, but works very well - every time I check, it seems to be accurate.)
  3. iPhone Wifi presence sensor (Driver - requires a fixed IP for the devices it checks, but works quite well)
  4. Google Wifi presence via IFTTT / Virtual Switch (Works most of the time)

I use Geofency and iPhone wifi. That seems to be enough for my family for it to work reliably. Geofency is only $2.99 and that purchase can be shared with the family without cost if you've enabled family sharing on your Apple accounts. Given the cost of the rest of the system, $2.99 seems a small price to pay.

My two failure modes are:

  1. Forgetting to take your phone with you when leaving. No amount of additional apps on the phone will help with this.
  2. Disabling the app accidentally. I found that enabling Offload Unused Apps on the iPhone will cause it to offload Geofency, as the iPhone doesn't recognize that it is being used. Taking care of that issue made things work smoothly again.
1 Like

@jwetzel1492 I believe I've discovered a race condition. Are you checking the state of the output virtual presence sensor before you set it? If not, can you please add a check and if it's already set to the correct value, not set it again?

I have configured multiple Advanced Combiners and it appears they are triggering at nearly the same time and that my virtual presence sensor is getting set multiple times - which results in my departure RM being executed multiple times.

Thank you.

To make sure I understand, are you saying that you have multiple Combiners, all affecting the state of a single output sensor?

Yes, that is correct.

I would recommend not doing that. I can't guarantee any kind of logic of how the output sensor will behave if you have multiple combiners affecting the same output.

Are you trying to combine multiple people to get like an "Anyone is Home" sensor? If so, here's my recommendation:

  • 1 combiner for "Bob is Home"
  • 1 combiner for "Susan is Home"
  • 1 combiner that uses those 2 as inputs, and the output is a separate "Someone is Home"
1 Like

No.

How else can I implement all of the various combinations of four different presence sensors?

The Advanced Combiner doesn't appear to permit more than a single 'All of these are not present'.

Ideally, a single Advanced Combiner would permit me to configure:
'If the output is Present, then make it depart if:'
Any = NULL
All = s1+2+s3 OR s1+s2+s4 OR etc.

To be frank, that sounds like a mess of spaghetti that would be difficult to unravel and make reliable. That said, I don't know what presence sensors you're using or your setup. It may be a necessary mess of spaghetti that you want for good reasons.

So, if you send me a pull request on GitHub, I will review it and would likely incorporate it. Even after that though, I would still recommend re-evaluating your sensors and seeing if there might be a simpler way to solve this.

Actually, on 2nd thought, I just can't recommend using multiple advanced combiners on a single output at all. The advanced combiner especially. Because its logic depends on the state of the output, in addition to changes in the inputs. It is a guaranteed race condition with undefined results if you do this.

1 Like

Sorry, I don't know how to use GitHub, nor do I know Groovy (or is it Javascript?). I only know C from 20 years ago.

I concur but until someone invents an iOS app presence app that actually works...

I've had very good results using the Standard Combiner with 3 inputs:

  • iPhone Wifi presence
  • Using the Alexa app on the phone to control a virtual presence sensor
  • Using App Homekit on the phone to control a virtual presence sensor

I do not personally use the presence from the Hubitat iphone app. I did not get good results from it.

Why restrict output to a single presence sensor?

Because there is only one of you ... unless you've managed to clone yourself?

PS, good practice is to have one composite "presence" per person.

1 Like