[UPDATED] iPhone WiFi Presence Sensor

I had to do two things. The first was to comment out the polling in the driver code :

I then created separate RM rule to refresh. This gives me control on how often I poll and I found that 15 seconds was the optional.

My final rule is:

YMMV

2 Likes

Could you have just replaced:

runEvery1Minute(refresh)

with:

schedule("0/15 * * * * ? *", refresh) ?

That way it stays within the driver code and you don't need a separate RM rule. Although I see you are also refreshing a thermostat which this will not do.

Exactly. I have a 15 second poll and 5 minute poll rules for specific devices.

Randy, if you're still getting false negatives, I recommend to start reading at the top of this thread:

Would like to set a 30 second refresh and would like to do it in the driver code. I tried replacing the line with:
schedule("*/30 * * * * ? *", refresh)
schedule("0/30 * * * * ? *", refresh)

Either way my logs still show a 1 minute refresh. I simply hit save in the driver to make the changes and I also tried rebooting the hub. Should changes made to the driver automatically change the behaviour of the device or do you have to reinstall the device?

Thanks for any help on how to change the device driver to a 30 second poll and then have the device run the modified driver.

Try this:

Add an unschedule() to remove any schedules that are in place)

	unschedule()
	schedule("*/30 * * * * ? *", refresh)

Save the device code. Open the presence device, save the device and make sure you also 'Save Preferences'. Then it should work, It does on mine.

Thank-you Matthew!!! Works Great.

Just wanted to say thanks for this, it works on both Pixel XL and Pixel XL2 running android 9. Using this as a backup for presence in case the android app does not catch it.

1 Like

Thanks for this! :grinning:

I can confirm that it works with the MotoX4 (Android One version if that matters)

Just installed this to use with my Android Galaxy S7 and it seems to be working fine.
Thanks a bunch.
One minor thing though, the box named 'Timeout Minutes' is actually the number of failed pings before changing the state to 'Not Present'. Confused me a bit, at first.

Thanks again. This looks like the solution I've been looking for.
Jim

Well, I can see why that would be a little confusing...:thinking: However, the driver checks every 1 minute. So, I am guessing the author felt that the number of counts equals number of minutes. Most users prefer to think in units of time. :wink:

So, if I call this to run every 15 seconds, I need to change the timeout box (minutes)?

I changed the code to run it every 15 seconds for prompt arrivals for opening garage doors.....

I believe you would need to assume the timeout box is in units of quarter-minutes, instead of full minutes. So enter a value 4 times greater.

Of course, you could modify the code to calculate the correct timeout value/number of counts automatically.

Yup, this was purely laziness on my part to code it this way. :slight_smile:

I really should go back in and do it right...

thanks for the app. This works great with Moto G5, G6, X4 and Pixel 1. We dont do fruit so i had to modify the code. Mine properly shows in the apps as "Wifi presence sensor"

Hi, I can see my S8+ & my wifes S6 in devices. When I go into RM I can't see either of them,. Can anyone advise what I haven't done to make them visible please

Have you selected the WiFi driver as their drivers?

Hi, Sorry for not replying earlier, I've been away. Yes I have selected the iPhone Wifi Driver as the driver. What 'Event Trigger' should it be located within?? I'm pretty sure I've looked in them all?
They are both in the 'Devices' list, & both are showing 'Present' as we are both home.

Presence, but then saying that mine route through another app to combine them with others ie WiFi and GPS location which In turn uses another virtual driver but I'm pretty sure that they still show up in there.

Since the topic was discussed, I thought I would share what I've been doing. I maintained the default 1 minute polling interval, but use rule machine to poll every two seconds when mode is away and the deadbolt is unlocked. It then returns to 60 second polling. It usually detects presence with maybe three steps into the house, and this way I didn't have to change the app's code.