[UPDATED] iPhone WiFi Presence Sensor

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

@Siddharth: This is the way.

4 Likes

So in the setting of HTTP Presence sensor am I put in the IP Address of the Phone? Hubitat will ping this IP to see if it's online?

That is correct. Also, most newer phones will now try to randomize their ip address when they connect to wifi, so it's important to turn off "private WiFi address" on the phone's settings for your home network.

2 Likes

On the Samsung Series(maybe all androids), this is called "Randomized Mac". You have to click View More in the wifi connection and select "Phone MAC" to turn this off.

2 Likes

I installed this yesterday for my Samsung A53.
I made the address static and disabled randomized MAC for home wifi.

When arriving last night, I waited at the gate.
It took maybe 30 to be present, whereas the SmartThings arrival sensor takes a max of 20 seconds.
Still too long not to push the button though, lol.

I unplugged the phone and let it run overnight.
It didn't disconnect.
Pleasantly surprised.

I'm going to see how it works for my wife's Samsung S10.

I'm thinking I could somehow add these to the rules I have for the SmartThings sensors.
Don't want anything weird and unpredicted happening though, lol.

By default, the code tries to ping your phone once per minute. (And there are some retries in there.) For many people, that's the best timing. But depending on your wifi range, buildings around you, phone model, etc... it may work better for you to have the code ping your phone every 15 seconds. If you want to do that:

  • Open the driver code in Hubitat
  • Uncomment lines 87 and 88. (Remove the //)
  • Comment out lines 84 and 85. (Add the slashes)
  • Save
1 Like

Is there a downside to doing this?

It's more network traffic. On a modern wifi, it shouldn't be a problem.

1 Like

Thanks!
I'll check it out.

It worked very nice just now when my wife left the house.

One question though:
The description in 'Events' is very clear, but in 'Logs', not so much.
Is there anything I can do?
Thanks.
image

Not really. The logging is what I put in to help me make it work, back when I wrote it in 2019. One day I may get enough free time to make the logging more useful for non-programmers.

1 Like