Compare Presence

I'm looking to create a rule that will notify me (pushover) if my iPhone presence and Life360 presence are not synced after 2 minutes. In other words, if I leave and one sensor detects the departure but 2 minutes later the other has not also changed, I want to know about it.

trigger: iphone or life360 changes
delay 2 mins
if iphone not equal life360 send pushover

might need a cancel in there too i'm thinking.

thoughts?

1 Like

Don't see why you'd need a cancel. It's just going to wait 2 minutes as you said, do the comparison, and notify. You will actually need an IF-THEN to test both presence conditions, like this:

IF ((iPhone present AND life306 not present) OR (iPhone not present AND life360 present)) THEN

I think this rule will do what you want. Basically, only notify you if both presence sensor do not match for at least 2 minutes. I liked your idea so I added it for myself as well. Thanks!

I like this idea too BUT what do you do with the notification? Is there a common “fix” you do when seeing this?

For me, I just am curious to compare how frequently the Hubitat Mobile App Presence device and the Life360 Presence device get out of sync. I don't even know if this is a problem...yet... :wink:

1 Like

@ogiewon This is a great idea, but wouldn't it be a perfect example of an XOR gate?

2 Likes

Good question. Have you tested it using XOR? Seems like it should work...

I'll find out later when I leave. I've been noticing a delay from my Hubitat geofence lately so hopefully this will tell me.

Mainly for troubleshooting presence... This morning I was poking around my HE and noticed my dad was still present (Life360) at my house - but he left last night. I was able to "fix" it using the Life360 Refresh (because Life360 KNEW his correct location).

I have also had instances where the Mobile App "trigger" of enter/exit of geofence was missed by HE.

So I'm trying to identify when and how often these behaviors occur.

2 Likes

Will be my first attempt with XOR - fun.

1 Like

I just tested the XOR optimization and it works great! Thanks for the tip!

1 Like

Could you guys explain how that XOR works?

It’s never really been clear to me.

This probably explains it best...

image

1 Like

That does it, thanks!

So if I want to expand on this rule and include my wife's Life360 vs her App presence - can be done in same rule, or need second rule?

I simply cloned my Rule, and then edited the clone to use my wife’s presence devices.

This isn't exactly what you asked, but the Combined Presence community app can take two forms of presence and compare them to get a single output. It works quite well, and it has timeouts, logic, and everything built in. I use GPS, WiFi, and Smartthings presence sensors to get a picture of who is home.

The basic logic I use is if ALL of one person's sensors leave, they are AWAY. If ANY of the sensors are present, they are HOME. You can do ANY or ALL for away or arrived.

You could take this combined output and send notifications if you want to. If you are just looking to see if they are different and you are manually fixing the incorrect presence, this might help automate that for you so you don't have to manually reset things.

Combined Presence author here. I did put an advanced option in to have it send you notifications if any of the input sensors stay out of sync with the others for too long. However, I just realized I haven't seen one in a while (and I know my input sensors aren't THAT good.), so I might need to do some testing on it. It's unfortunately a cumbersome thing to test.

@bravenel

Ok, so I have had this working since the earlier post. What I have observed is Life360 is more accurate than the iPhone app. It seems if the iPhone trigger (entering/leaving geofence) is missed by the app - it stays out of sync. However, if Life360 misses an event - it eventually says "oh yeah, he's home (or gone).

I have found simply opening the iPhone app triggers a new geofence event and the status corrects. However, one time I found the app had "signed out" and I had to sign back in to correct - not cool.

Couple of thoughts. First, why is the app signing out - ever. If a person uses the app on rare occasions, but relies on it for geofence events, that is problematic.

Second, is there a way to "poll" the iPhone app and/or Life360. I know there is a "Refresh Life360" button and that seems to work - not sure how to tell an app to do that. What about the iPhone app - any way to trigger a refresh?

This would need to be like "while XOR do poll Life360 and iPhone app" and repeat every 5 minutes or such.

Here's what I have at this point:

Agreed. We will look into this -- it should not happen.

There is no polling mechanism for either that I'm aware of.