[UPDATED] iPhone WiFi Presence Sensor

Yes, there is a new driver up at Feb 8. Go get it!

That did it, thanks!

Tried to add the app to Hubitat. I keep getting this response.
Metadata Error:Please check if you inadvertently pasted driver code into apps code window on line 19

Are you adding code to the Apps Code or Drivers Code? This driver requires that you add into the Drivers Code section.

1 Like

Yep. I thought it was an app. Thanks!

1 Like

My iPhone continually becomes "not present" in spite of not being moved from it's "present" place in my house and being on my wi-fi network. What might be going on?

Your iPhone is periodically turning off its wifi to save battery. There are two options:

  • Increase the timeout on this driver to be longer than the average iPhone sleep. (I think people have had good results with 15 minutes.)
  • Or, use this in combination with a second method of presence detection, such as Geofencing. There are many discussions of this option up higher in this thread.
2 Likes

There may be a third option, but that depends on the use case. In my case, I only use the presence to unlock the house when I arrive. It doesn't matter whether my iPhone drops from the Wifi when I'm home or away. It only matters for those 15-20 seconds when I arrive.

That may help to define if the "not present" really is an issue.

My desire in using this sensor was to assure that my arrival home was transmitted to HE as quickly s possible so that Home Mode runs. I have Life 360 and an Iris V1 fob but I still find the door locked when I turn the knob. I set the timeout for 15 minutes and created a rule that refreshes it every minute but still find that my Mode is set to Away once or twice every hour. Any other ideas? It would be nice to use this 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: