[UPDATED] iPhone WiFi Presence Sensor

[UPDATE] I just saw your other post:

I think that will do what I was thinking about and this one may be specific to iPhone?

Yeah this is specific to the HTTP response codes and statuses that the iPhone returns. Other devices such as Android phones MAY return the same responses. But I don't have one to test.

The other device handler tries to do an HTTP GET and looks for a status code 200.

It worked on my Nexus 5x. It showed present when i was connected to my wifi. Then I turned my phone off and it showed not present.

Excellent!

Confirmed, working on Android Pixel XL too.

1 Like

My S9 works and looks like my wifes nokia 6 does as well!

Do you just put the ip of an Android phone?

Yes. Worked on my Note 9 too.

The iPhone version

Seems to work with an iPhone Xs Max and a Samsung Galaxy S8+. Both show ONLINE when they are active and go OFFLINE soon after any phone activity stops.

I have to think about any use for this? As you stated ONLINE is definitely present, but OFFLINE really doesn't provide any useful information (it might be present, or it might not be).

It's interesting that the phones are behaving differently. I've been watching mine all day (it's an iPhone SE if that matters) and the presence sensor only goes OFFLINE if I turn on airplane mode or leave the house. I wonder if I have a ton of apps constantly requesting updates, so it's just never going to sleep. Hard to know.

What I've done with this is basically make composite presence. I have this as a presence sensor, and I use the Alexa app as another presence sensor. Then if either of those are present, I have rules that set a "combined virtual sensor" to present. That way if Alexa doesn't detect my arrival fast enough when I drive up to the house, the phone will at least connect to wifi when I get in the driveway.

It could be something to do with “location services” you have enabled more than just the apps themselves.

Do have the location services toggle switched to on and any app set to “always”? I’ve noticed that it seems to keep the phone more active even if it locked.

Yes, I do have "Always" for some apps, such as Alexa.

I can’t be certain, but I think this and possibly “background data” are the two biggest things that keep an iPhone from sleeping. But I’m no expert.

My assumption is that if you have “location services” on that it won’t let the phone sleep completely if something is set to “Always”.

Who doesn’t have at least one app with always on? For 99% of end-users this will work without ANY device prep. Meaning once the device hits your network, you have a reserve IP and then can create a presence device for that phone. This is a HUGE benefit especially if you want to do something cool for guests who are staying longer than anticipated and can modify rules and routines simply based on if those guests are present at your home.

THANK YOU @jwetzel1492 for creating this! You have solved the last puzzle for Presence for me. Now be careful as the HE team may permanently borrow this for additional presence capabilities like they have with @Cobra’s many app contributions. :stuck_out_tongue_winking_eye:

2 Likes

Great app! But now that it works with Android phones too I would like to formally ask that you change the name! :grin::grin:

Also, one other small request. Please add a switch to turn off the logging.

Thanks

3 Likes

I have a Huawei (android) but it does not appear to be working.
Can the android users out there confirm how they configured the device.
Is it just the ip address. 192.168.0.xx?
I've tried various combinations with no joy.

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