[UPDATED] iPhone WiFi Presence Sensor

I'm testing this on an iPhone 6s on version 13.3. Here are the logs, I only got one "OFFLINE" line once, then hundreds of refreshes afterwards. Here are the initial logs after install, all the recent ones were just refreshes.

dev:2582020-02-07 10:29:41.079 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:28:41.075 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:27:41.079 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:26:41.120 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:25:41.134 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:24:41.071 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:23:41.073 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:22:41.080 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:21:41.234 pm debugLotus iPhone (Http) is OFFLINE
dev:2582020-02-07 10:21:41.111 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:20:41.127 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:20:25.994 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:20:21.121 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:20:18.900 pm infoLotus iPhone (Http).updated()
dev:2582020-02-07 10:19:48.108 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:18:48.085 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:18:36.298 pm debugLotus iPhone (Http).refresh()
dev:2582020-02-07 10:18:34.106 pm infoLotus iPhone (Http).updated()
dev:2582020-02-07 10:18:34.103 pm infoLotus iPhone (Http).installed()

I am finding this driver very useful and I am wondering if there any way to increase the duration between checks to greater than 1 minute? Thank you.

Absolutely! For example, on the line that has "runEvery1Minute", you could change that to "runEvery2Minutes".

4 Likes

Ha - I learned something new.

Based on the SmartThings developer docs, I thought the only runEvery*() methods available were runEvery1Minute(), runEvery5Minutes(), runEvery10Minutes(), runEvery30Minutes(), runEvery1Hour(), and runEvery3Hours().

And that schedule() was used for all other times ....

1 Like

Actually, you are correct and I misspoke about runEvery2Minutes.

2 Likes

IMPORTANT UPDATE FOR ALL USERS OF THIS DRIVER:

It has come to my attention that there is a possibility my driver has contributed to slowdowns for some users, due to not having a timeout set on the http GET request it makes. I don't know for certain that this is the case, and there are likely many things that can cause hub slowdowns, but I sincerely apologize if it is the case. I have not had slowdown issues on my own hub, and at the time I wrote the driver, timeouts were not yet a parameter on that api. I see now in the documentation that it was added as a parameter several months later. (The documentation says the default is now 3 minutes, but I do not know what it actually was on the earlier versions where you couldn't set it.)

That said, I have made several updates to the driver that are now posted here:

I recommend all users update to the latest version. Then, go into each of your device instances and push the "Save Preferences" button.

Major changes:

  • It now has a timeout of 10 seconds on the requests
  • There is a preference to disable it, and stop it from making requests to your phone. (This is if you want to test a difference with it on or off.)
  • I have one option in there that I did not want to expose an explicit option, but you can enable it if you know how to uncomment the code. The default is to ping your phone once a minute. But on my system, I have it pinging every 15 seconds. That's disabled here, but you can switch it up if you read the code.

I recommend all users perform this update ASAP.

8 Likes

Getting errors after updating, rolled back and errors stopped. Nothing changed apart from this. I rolled back by using your version publish in Feb 2019. I'm not getting slowdowns.

(i did save preferences, and didnt work).

I see these errors after the update. I have my timeoutMinutes set to 60 since our phones seem to often put the wifi to sleep to save battery which was causing them to disappear and return throughout the night too frequently.

1 Like

@Terk, did you click the "Save Preferences" button on your device page? This error looks like you still need to do that step.

@mike, those aren't errors, per-se. That's the message that an iPhone returns when you ping it. If your iPhone is present, it will refuse connection. Turn off debug logging if you don't want to see it in the logs.

Huh! Color me suprised. I guess I didnt know how it worked before the update. Thanks.

Yeah I did both save settings and save preferences, I’ll try again later today. It's quite possible those logs occurred between the driver update and the save preferences, I'll monitor today. You were right, those logs must have been between the update and pressing save preferences as i haven't seen them repeat. Thanks!

1 Like

works with the S10+ galaxy android

I'm working on moving my home network over to a new unifi system. All smart home devices will be on a IoT vlan and mobile device on the main. Will the WiFi presence sensor still work?

Just from what I have read regarding other wifi devices and Hubitat, they need to be on the same vlan. I may be wrong, but It was my understanding that you wouldn't be able to locally control hubitat either from a device on a different vlan.

Check this app out if you're switching to Unifi. I use that one along with this one to feed a combined WiFi presence sensor.

I'm having an error show up whenever the system tries to refresh the status of the phone.

dev:6422020-04-21 10:54:51.038 am errorgroovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.Integer#div. Cannot resolve which method to invoke for [null] due to overlapping prototypes between: [class java.lang.Character] [class java.lang.Number] on line 98 (refresh)

I reloaded from the github to ensure I have the latest code (was doing that all last night), but could have missed one.

Edit: Just saw above you mentioned the need to hit "save preference" on each device I have.
I just did that and will monitor.

I'm seeing this same error:

2020-04-21 08:42:39.086 am [error](http://192.168.0.51/device/edit/54)groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.Integer#div. Cannot resolve which method to invoke for [null] due to overlapping prototypes between: [class java.lang.Character] [class java.lang.Number] on line 98 (refresh)

Sadly I didn't back-up the older driver.

Just did the save preferences. Will update sooon.

Goes without saying, but Thank you so much for this app.
My Presence on HE has been 1000x more reliable thanks to this add-in as a factor in my combined presence.

Thank you.

5 Likes