[UPDATED] iPhone WiFi Presence Sensor

Make sure your device has a reserved IP and then enter that IP into the device. It takes up to 3 minutes to detect your mobile device. Should work though.

1 Like

LOL I'm fine if Hubitat wanted to build this directly into the hub software. That would be awesome!

Is there any interest in another option for combining presence sensors? @Cobra's Presence Central is really cool, but it had more features than I needed. I just had two semi-reliable presence sensors and wanted to combine them into one more-reliable sensor. I built a simple app that combines two or more presence sensors (it just uses a boolean-OR on their "present" values) and uses that to set a combined virtual presence sensor.

It also works nicely for daisychaining. Here's how I have mine set up with 3 "combiners":
"My iPhone Alexa" + "My iPhone WiFi" --> "My combined presence"
"My wife's iPhone Alexa" + "My wife's iPhone Wifi" --> "My wife's combined presence"
"My combined presence" + "My wife's combined presence" --> "Somebody is home"

So now I can make RM rules based on individual people arriving. And if I want a rule for when the last person leaves the house, I just trigger on "Somebody is home" changing to "not present".

It's nice because it keeps the combination logic outside of Rule Machine.

(One more note: Using a boolean-OR to do the combinations only works because my two methods of detecting presence sometimes have false negatives, but do not seem to have false positives. If a presence sensor had false positives, then this would be unsuitable.)

3 Likes

You can speed it up by clicking "refresh" too.

Also, if you want faster OFFLINE triggering (for example if your phone seems to stay connected perfectly at home, or if you don't mind more false negatives), look in the code at line 60. Change the "if(state.tryCount > 3" to 2 or 1. I may make this a configuration setting.

2 Likes

I would be interested in your simplified presence manager. Honestly that is what HE is missing where Hass.IO has a great advantage over all the home automation solutions (one of few advantages mind you).

The benefit of @Cobra's solution is that if you just want Presence central with a little bit of Message Central without having to install all the additional apps you can. Also Cobra started these apps to solve problems for his home/family and then adapted each app to the community based on usage models. Ideally Presence Central should do what you are speaking of and then all of his other apps are add-ons to accomplish the extras.

1 Like

Seems it checks every minute. So (3) minutes should be acceptable for presence. If anything it might be too short especially when combining a GPSr presence with it. :slight_smile:

1 Like

Yes, that's probably why it should be configurable. Where I live, I'm ok if it takes 3 minutes of driving away before my house notices I'm not there and double-checks the door locks. If I was still living in a city, I would probably rather have the house fail on the side of locking the doors faster and more than necessary. And at the extreme, I might not use presence for locks at all. I might just set up the locks to automatically re-lock 30 seconds after they unlock, every time. Would really depend on my living situation.

4 Likes

That's what I have done.
Doesn't matter if I put in mine or my wife's Samsung ip address they both stay not present.

I am not sure then. I like @jwetzel1492 do not own a Droid. Did you try the other Wifi Presence Sensor he posted? I believe it is slightly different.

@jwetzel1492 Is the biggest difference between the two versions what you are looking for in a response? If so maybe combining the two and then allowing the device driver to have an option for iOS or Android. Thoughts?

Unfortunately, if I put an Android toggle in, then Android is "supported", and there's no way that's going to practically work out well. I don't have an Android, and apparently some of them behave differently than others. (So it wouldn't help even if I had just one.) So I've put a compatibility list at the top of this post to list devices that others have said it worked on, but I don't want to mislead anyone into thinking it can do something that I can't verify.

To be honest guys,
I have been thinking of making ‘lite’ versions of some of my apps for a while.

As @aaron stated, I originally created my apps to serve a need I had.
With multiple feature requests for every app, they have all ‘grown’ beyond what I envisaged.

Presence Central talks etc.. I never use that as I just use it for reliable presence.
Message Central has so many trigger now it’s HUGE (5000 lines) and I (and probably a lot of other people) don’t use many of the features.
A single switch trigger version would cover most of my uses.

I may well look stripping these two apps down when I get the chance.

Andy

2 Likes

So no port is needed.

Ok instead of a device branding maybe a HTTP request selection. So if lets say iPhone WiFi presence is looking for XYZ response but the other looks for ABC response the end user could try option 1 or option 2 to get the majority of the devices to work with a single device driver. Just thinking future as you will find this solution to grow rapidly once people realize the power of LAN based presence awareness without having to modify devices for presence that a mobile app related.

Has anybody tried this with an Apple Watch, yet? I'll probably give that a whirl later today, since it's a better indicator of when I'm at home.

Edit: I'm testing it with the HE at our office. I'll post the results.

Edit 2 (Results): I've gotten it to respond as present. I'll keep an eye out for how consistently it reports my presence.

Edit 3: Further testing indicates that the watch will go offline to save power---at least when connected to my phone via Bluetooth. I'm disabling BT and seeing what happens.

Edit 4: Even with BT off, the watch still disables WiFi (or puts it into some power-saving mode) until necessary. Looks like the Apple Watch isn't going to be a viable option, even though it will occasionally respond.

Conclusion: Apple Watch (Series 4) tested. Does not respond with enough consistency to use, but it does occasionally respond.

3 Likes

That would be awesome. This is the main reason I haven't tried quite a few apps out there yet (including yours). I don't mind a few extra features, but I like my apps to be as streamlined as possible so I end up just writing my own.

This was the primary reason I stopped using Rooms Manager. A FANTASTIC app that just got too big for me over time. I ended up writing my own simplified Occupancy app instead.

I look forward to Cobra "Lite".

1 Like

Small update to the driver:

  • Preference to change the timeout (approximate time without a response before deciding the phone is away)
  • Preference to turn logging off

Get it here:

https://github.com/joelwetzel/Hubitat-iPhone-Presence-Sensor

3 Likes

Thanks for the updated code, definitely a great option for improved presence detection. I'd like to report it works great on Pixel 3XL models also.

Since it's confirmed working on both Android and iPhone perhaps the name of the driver should be changed to just "WiFi Presence Sensor" so that anti-apple users like myself don't feel so "dirty" using it? LOL

Edit: I may or may not have already taken the liberty of modifying the code myself with these name changes already :wink:

Yes I would encourage everyone to do a find-and-replace in the code of "iPhone" with "Your phone model here" when pasting it in. :stuck_out_tongue:

1 Like

I think the app name “I know Where You Are” is nice.

IMHO, I would want all the Android extras not in the iPhone version, only God knows what could happen. :joy:

1 Like

I would rename the app to LAN Presence. I plan on getting rid of the ST presence sensors from the car and putting in WeMo D1's that connect via WiFi. So not really Phone related anymore. :slight_smile:

To test this functionally I created a simple trigger in RM that sent out a Pushover notification when presence was true. I went to bed and when I woke up I had gotten a message every 10-12 minutes.

I have an iPhone 6s so I’m guessing this is the sleep / wake issue you were talking about.