[UPDATED] iPhone WiFi Presence Sensor

Unfortunately, this isn't working well on my S7. It keeps showing my presence as dropping and re-connecting at random times, even though, according to my router, my phone has remained connected the whole time.

I turned off all battery saver functions, but it didn't seem to help.

Does anyone have any suggestions?

So I plugged the phone in last night at 10:30 pm, and unplugged it a little after 8 am. While the phone was plugged in, it didn't disconnect once. After I unplugged it, it began disconnecting again at random times. This is despite the fact that I have turned off all battery optimizations, set several apps to not optimize battery usage and never sleep, and even installed an app from the play store which claimed to keep wifi awake. It seems like no matter what settings I use, I can't keep the phone from putting wifi to sleep when it's not plugged in.

Throw your iPhone out of the window and get an Android phone lol :wink:

2 Likes

This is with a Galaxy S7!

Woop ha ha ha :smile:

I'd say to increase the delay before timing out, but one time your phone put wifi to sleep for a full 30 minutes. That's too long.

I agree. I once saw it asleep for over an hour, but it came back immediately as soon as I turned the screen on. The weird thing is the router showed the phone as connected the whole time.

It's not necessarily that weird. WiFi devices can connect to an AP and tell the AP that they will be a sleepy device. It tells the router to not drop the WiFi connection for these devices, even though they are inactive for a while (usually to save battery power.)

1 Like

@bissadaj

I agree with what @ogiewon has written. My Google WiFi displays my tablet as connected for at least 20-30 minutes after the tablet is powered off.

One of my old phones (I think it was a Nexus 6) would drop off the WiFi network when it went to sleep which messed with automations that depended on my phone being WiFi connected to my router. I found an android app called "WiFi Keep Alive" that prevented the WiFi connection from being dropped. Maybe you could find something similar.

I tried WiFi Keep Alive (and a few others like it), and unfortunately, I'm still getting the regular drop offs. It seems like no matter what I have set, the phone won't keep the wifi on unless it's plugged in.

I set this up yesterday on my Samsung S10+ and my Wife's Samsung S10+. I set the polling to 15 seconds just to have a better test bed for connectivity issues. It has been dead spot on for the past 24hrs for both devices. Really cool "device"...

I'm 100% new to Hubitat and smart automation, soooooo much info that my head spins lol I've not used the device yet as I've not fully wrapped my brain around the Rule Machine, but I'm sure it will be handy down the road!

1 Like

Welcome.
Home Automation (HA) is certainly like the proverbial "rabbit hole".

also check out simple lighting and motion lighting. There are heaps of options in there to start before you need to dip into RM :wink:

1 Like

How would I build in a cancel for if I'm already home, and the Hubitat app thinks I depart for a few minutes, which occurred today. (I noticed this rule was repeating every 10 seconds, and that's because I never left). I'm just not sure which cancel, or even where to put it.

image

I haven't played with the App presence much. I connected it to my alarm switch so it can only know to turn on when I'm away. I'll look at that app later today.

@jwetzel1492 Thanks for this device, it has reliably been my presence sensor for at least the last six months. If you ever plan to update the driver, I humbly request you add in the ability to adjust the frequency in which it polls the device. By default it does it every 1 minute. I know you can change the driver code for more frequent polling and I have tried that, but as I am no programmer I always need help with something like that. Currently I would like to simply have the driver poll every 5 minutes, I don't need more frequent polling since I have a rule that results in the driver polling my phone everytime someone approaches a door (Blue Iris Camera Trigger). This works sweet and the door always automatically unlocks when I am walking up to it, since this is when the Rule forces the driver to refresh.
Thanks for the consideration.

in the driver code at line 72, change the runEvery1Minute(refresh) to runEvery5Minutes(refresh)

@Stephan.J

If you change the refresh timer as suggested by @jon1, don't forget to change the timeout time as well.

Tried your suggestion and got this error in my logs:
groovy.lang.MissingMethodException: No signature of method: user_driver_joelwetzel_Smartphone_WiFi_Presence_Sensor_481.runEvery2Minutes() is applicable for argument types: (java.lang.String) values: [refresh] on line 72 (updated)

Does not work, did this work for you?

I remember when I wanted to change the refresh timer to 30 seconds, I tried:
runEvery0.5Minute(refresh)
I know nothing about writing code and a member helped to change the line to: [RELEASE] iPhone WiFi Presence Sensor

Goes to show it ain't as obvious as one might think. LOL

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