[UPDATED] iPhone WiFi Presence Sensor

Under the same conditions, different results are repeated, so it seems that it is not a problem with phone settings.

I’m not quite sure I understand your reply.

But in the virtual device’s settings page, what is the timeout setting?

2 Likes

I suggest increasing your timeout to at least 10 minutes, like in my screenshot.

4 Likes

iPhones like to conserve their battery life when not in use, by temporarily turning off their WiFi radio for about 9 minutes. They then reconnect, check for any updates that may have been missed during that time, and then repeat that cycle.

This was discussed earlier in this thread

Thus, it is 100% normal for this driver (with a timeout less than 10min) to report Arrived and Departed when an iPhone is in your house, but idle. Using a timeout of at least 10 minutes, as mentioned above by @marktheknife, should help to alleviate this issue, if this is your only method of determining user presence. Many people use this driver in combination with other methods. Personally, I simply use the "Locative" geofencing app on my iPhone as it works very reliably, is free, respects privacy, and hardly uses any battery.

6 Likes

Thanks for elaborating, @ogiewon :slight_smile:.

@jw970065 you should not use only this method for determining arrival/departure, since as @ogiewon explained, the behavior you’re seeing is expected and mostly an unavoidable artifact of how iPhones automatically manage power usage while asleep.

As it says in the OP:

The developer of this driver also wrote an app that can combine more than one presence device, it creates a new virtual device that can be used for much more reliable presence-based notifications or automations.

If you don’t care at all about how long it takes for your phone to show as “departed” using this driver only, you could set the timeout to something very high like 15-20 mins. That might work around the issue. But like @ogiewon I also use other solutions like Locative, which is a separate iOS mobile app but can be integrated with Hubitat.

6 Likes

Thank you for the good advice. I'll try changing the setting.

1 Like

Thank you for the good advice.
It would be great to combine and operate various things.

hello, smallest timeout is 1 minute before showing the device offline, does anybody know what needs to be changed in the code to lower that? i need it to start my surveillance camera if electricity is off and i'm using this to detect the power surge but i need it faster than 1 minute.
what needs to be changed in the code to mark the device as not present in 10 seconds?
thanks
using 0.1 doesn't seem to work

In the code, you’ll find the following section

    if (enableDevice) {
        runEvery1Minute(refresh)		// Option 1: test it every minute.  Have a 10 second timeout on the requests.
        state.triesPerMinute = 1

	    //schedule("*/15 * * * * ? *", refresh)    // Option 2: run every 15 seconds, but now we have a 10 second timeout on the requests.
        //state.triesPerMinute = 4
    }

Simply comment out the first option and uncomment the second option.

    if (enableDevice) {
        //runEvery1Minute(refresh)		// Option 1: test it every minute.  Have a 10 second timeout on the requests.
        //state.triesPerMinute = 1

	    schedule("*/15 * * * * ? *", refresh)    // Option 2: run every 15 seconds, but now we have a 10 second timeout on the requests.
        state.triesPerMinute = 4
    }

i've already set it up like that, when is present it sees it very fast but after is not present it takes about 1 minute, i need in less than 10 sec to detect it not present

1 Like

This quit working for me on December 3rd. Nothing has changed on my network or with Hubitat. The only thing I recall is an Android update. Phone IP has not changed and the MAC is not randomized. I'm hesistant to remove and reinstall because I have this tied to several webCoRE pistons. I have rebooted the hub. Debug logs show...

httpGetCallback(The following 'connection refused' result means that the hub was SUCCESSFUL in discovering the phone on the network: {"headers":null,"warningMessages":[],"status":408,"errorMessage":"Connect to 192.168.50.160:80 [/192.168.50.160] failed: Connection refused (Connection refused)","errorData":null}, data)

If you do a search for "connection refused" and select "in this topic", you will see a number of posts indicating that is exactly what it should say when present.

Search result

As to deleting and making a new version, you could create a virtual presence dummy device, and use the swap apps device. Delete, recreate, and then swap it back. Although, I do not think that would do anything as you are using the same device driver.

Might be worthwhile to go into Hubitat Package manager and run repair on the Iphone Presence sensor app/device.

I figured that out right after I posted it. It actually mentions that it in the logs but it's still confusing that an error is the expected behavior.

I ended up creating a new device and it worked so now I just need to replace the old device in all of my pistons.

The Swap Apps Device in settings is amazing.

2 Likes

Never heard of it. I'll have to check it out. Thanks.

Way easier than manually replacing in multiple locations

Hi, jwetzel1492

I am using this driver well on my Android phone. I think you should change driver's name.

But I found a problem.
I am attaching the contents below.

And I have a suggestion.
If you connect 2.4G or 5G,
It would be better if the phone was connected.

Summary

app:3742023-01-28 07:13:00.340 PMinfoAction: Wait for event: VP7 PIS wifi arrives
app:3742023-01-28 07:13:00.335 PMinfoAction: IF (VP7 PIS wifi not present(T) [TRUE]) THEN
app:3742023-01-28 07:13:00.284 PMinfoAction: END-IF
app:3742023-01-28 07:13:00.281 PMinfoAction: Off: Test 용 (skipped)
app:3742023-01-28 07:13:00.278 PMinfoAction: Wait for event: VP7 PIS wifi departs (skipped)
app:3742023-01-28 07:13:00.275 PMinfoAction: Wait for event: VP7 PIS wifi arrives
app:3742023-01-28 07:13:00.273 PMinfoAction: IF (VP7 PIS wifi present(F) [FALSE]) THEN (skipping)
app:3742023-01-28 07:13:00.269 PMinfoAction: IF (VP7 PIS wifi not present(T) [TRUE]) THEN
app:3742023-01-28 07:13:00.240 PMinfoAction: END-IF
app:3742023-01-28 07:13:00.239 PMerrorMultiple simultaneous rule execution error
app:3742023-01-28 07:13:00.214 PMinfoAction: Off: Test 용
app:3742023-01-28 07:13:00.175 PMinfoTriggered: VP7 PIS wifi presence changed
app:3742023-01-28 07:13:00.154 PMinfoWait over: VP7 PIS wifi departs
app:3742023-01-28 07:13:00.146 PMinfoEvent: VP7 PIS wifi presence not present
app:3742023-01-28 07:13:00.144 PMinfoWait Event: VP7 PIS wifi presence not present
app:3742023-01-28 07:10:00.470 PMinfoAction: Wait for event: VP7 PIS wifi departs
app:3742023-01-28 07:10:00.462 PMinfoAction: IF (VP7 PIS wifi present(T) [TRUE]) THEN
app:3742023-01-28 07:10:00.439 PMinfoAction: END-IF
app:3742023-01-28 07:10:00.385 PMinfoAction: On: Test 용
app:3742023-01-28 07:10:00.368 PMinfoTriggered: VP7 PIS wifi presence changed
app:3742023-01-28 07:10:00.319 PMinfoWait over: VP7 PIS wifi arrives
app:3742023-01-28 07:10:00.317 PMinfoEvent: VP7 PIS wifi presence present
app:3742023-01-28 07:10:00.307 PMinfoWait Event: VP7 PIS wifi presence present
app:3742023-01-28 06:42:00.332 PMinfoAction: Wait for event: VP7 PIS wifi arrives
app:3742023-01-28 06:42:00.328 PMinfoAction: IF (VP7 PIS wifi not present(T) [TRUE]) THEN
app:3742023-01-28 06:42:00.304 PMinfoAction: END-IF
app:3742023-01-28 06:42:00.302 PMinfoAction: Off: Test 용 (skipped)
app:3742023-01-28 06:42:00.299 PMinfoAction: Wait for event: VP7 PIS wifi departs (skipped)
app:3742023-01-28 06:42:00.294 PMinfoAction: IF (VP7 PIS wifi present(F) [FALSE]) THEN (skipping)
app:3742023-01-28 06:42:00.207 PMinfoTriggered: VP7 PIS wifi presence changed
app:3742023-01-28 06:42:00.180 PMinfoEvent: VP7 PIS wifi presence not present
app:3742023-01-28 06:41:39.160 PMinfoInitialized
app:3742023-01-28 06:41:37.175 PMinfoAction: Wait for event: VP7 PIS wifi departs
app:3742023-01-28 06:41:37.171 PMinfoAction: IF (VP7 PIS wifi present(T) [TRUE]) THEN
app:3742023-01-28 06:41:35.768 PMinfoInitialized
app:3742023-01-28 06:40:21.469 PMinfoInitialized
app:3742023-01-28 06:40:17.092 PMinfoInitialized
app:3742023-01-28 06:40:10.933 PMinfoAction: Wait for event: VP7 PIS wifi departs
app:3742023-01-28 06:40:10.929 PMinfoAction: IF (VP7 PIS wifi present(T) [TRUE]) THEN
app:3742023-01-28 06:38:00.326 PMinfoAction: Wait for event: VP7 PIS wifi departs
app:3742023-01-28 06:38:00.321 PMinfoAction: IF (VP7 PIS wifi present(T) [TRUE]) THEN
app:3742023-01-28 06:38:00.256 PMinfoTriggered: VP7 PIS wifi presence changed
app:3742023-01-28 06:38:00.232 PMinfoEvent: VP7 PIS wifi presence present
app:3742023-01-28 06:37:31.488 PMinfoInitialized
app:3742023-01-28 06:37:28.887 PMinfoInitialized
app:3742023-01-28 06:35:00.381 PMinfoAction: Wait for event: VP7 PIS wifi arrives
app:3742023-01-28 06:35:00.376 PMinfoAction: IF (VP7 PIS wifi not present(T) [TRUE]) THEN
app:3742023-01-28 06:35:00.346 PMinfoAction: END-IF
app:3742023-01-28 06:35:00.342 PMinfoAction: Notify Telegram hubitat7: ' %device% 가 도시어부를 떠났습니다.( VP7 PIS wifi 가 도시어부를 떠났습니다.)' (skipped)

1 Like

It is possible to detect the device's presence by its MAC address as the IP keeps changing in the local network.

Turn off “private WiFi address” in your iPhone’s settings when connected to your home SSID, then set a DHCP reservation for your phone in your router’s settings page.

The phone’s IP address will then stop changing.

6 Likes