[UPDATED] iPhone WiFi Presence Sensor

runEvery2Minutes is not a function. only runEvery1Minute and runEvery5Minutes and 10 and 15 and 1hr etc, the documentation is here SmartApp — SmartThings Classic Developer Documentation

Thanks, I will read up on it. I am a little out of my league.

Just got the September update for the Note 10, and it keeps on dropping the wifi connection. No settings were changed by me.

Driving me crazy. Dont know how to fix it. Suggestions?

I'm trying to get this to work to augment my GPS-based sensors, but I couldn't get it to ever detect my phone as present! I verified the static IP address is correct on the router, and verified it on the phone. But it always shows it as not presence on the device, as well as on the tile when I put it on the dashboard.

Any ideas what could be missing or how to troubleshoot this further?

First off, What OS is your phone ?
Then forget about dashboard integration for now and just reference the Device driver tab.
Open a log tab and report what the logs show.

1 Like

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.

Download the Hubitat app