[UPDATED] iPhone WiFi Presence Sensor

I assigned by DHCP on my router. There were 4 and now 3 devices. Both galaxy phones and my HE have them. My firestick had one for a short time.

Little update:
I disabled those two IP Presence devices and within 24 hours my internet lag issues are history. My thought is to put the two devices back one at a time and wait a day in between to see which, if any, cause the issue to reoccur. Thanks for the help and I welcome any further suggestions.

1 Like

Wifi Presence has added a useful addition to my Combined Presence!

But I'm still on a quest to add to my 'presence detection methods' armoury.

I've discovered a Homebridge plugin named Homebridge-network-presence which I've been having a play with and managed (so far) to successfully get it to switch some virtual switches in HE.

Before I spend any more time with this...I was wondering if it might work in the same way as this Wifi presence app? If so, there's probably not much point exploring it any further.

Can anybody comment on whether this HB plugin functions in a similar way to iPhone Wifi presence? (I'm thinking yes...because it consists only of setting an IP address which it then detects whether or not is connected to the network.)

Thanks

I looked through the code of that HA plug-in. It looks like it’s using some underlying machinery of HA. I don’t know enough about HA though, o know what it’s doing under the hood.

some way to do the poll every more minutes, every 2 or every 3 for example? Thank you so much

1 Like

This is so awesome! Can't believe I've only just discovered this presence detection driver! Was just in the process of moving an ST script on an AsusWRT router to Hubitat with some improvements, only to discover it can be done from Hubitat directly!
Thanks
Side note, works on an S7, Pixel3 and Pixel4 - just filling in the gaps of your compatability list.

3 Likes

Works with Motorola Z4.
I suspect this will work with any phone. All you need to do is go into your WiFi router and do a DHCP reservation for your phone so that your Router will always give your phone the same IP address.
How to Set Up DHCP Reservations (and Never Check an IP Address Again) (lifehacker.com)

Hi, can you please add "Pause" and "Resume" commands? It would pause/resume ping of selected ip address. In paused state, it would still report the presence state which was before the device was paused.

Imagine when you sit at home, reading book or doing whatever that doesn't involve your mobile for an hour. After some time, mobile phone turns off wifi to save battery, which then results in presence going to "away". Solution I have in mind:
Presence device with this driver set to ping every 10 seconds, paused.
Rule Machine - when main door is open, "resume" presence device, wait 10 minutes, pause presence device.

This way, presence would be checked only in 10 minute window after opening main door. This gives plenty of time to enter car and leave (=disconnect from wifi), and on the other side, when I come home, the presence is checked in 10 seconds, as oposite to 1 minute, so the lights come on almost instantly. There is no way I'm suddenly not present when the main door doesn't open, so this solves Android's battery saving feature.

In the mean time you could setup your own version of this. Make a virtual presence sensor, and then you could have it do what you want. When you want it live have the actual sensor set the away departed status and when you want to pause then stop using the wifi sensor.

1 Like

Go deeper on this, @terminal3 I do something similar with mode changes but I'm curious how you'd wrangle it with presence.

It would pretty much be as he described. You setup a virtual presence sensor. When the actual WIFI Sensor, the phone, is live then anytime the phone presence changes send that state to the virtual sensor. Any rules you have are watching the virtual sensor. While this rule is active the virtual sensor and actual sensor are the same.

Anytime you want the device paused then pause the rule that sends the actual presence to the virtual presence, Once paused the virtual sensor will stay at whatever it's current sensor status is until the rule resumes.

Yes that would work, but then there would be "ping" for no reason every few seconds, 24/7. Thank you for doing this driver, it's really great, well written, so it was easy enough for me to update it. It now pings every 10 secs (timeout 2 secs), supports startPing/pausePing, and first ping is at the moment it gets "startPing" command, so the presence change is instant. If you ever want to add this to the driver, I can send you the code.

I'm currently trying this:

Combiner using my phone's presence + a virtual sensor that is turned ON by wifi detection and turned OFF by Away mode.

The thinking is that iphone wifi presence triggers the virtual sensor to ON - and it remains on even when the phone sleeps. This "acts" as the iphone wifi presence proxy, if you will.

My phone has a different IP address for 2.4 and 5GHZ. I guess I could just Install two different WIFI Presence devices but wondering why we couldn't just have multiple ip address in one device.

Since I want my phone to always connect to the 5g and not my 2.4 when I come home, I have configured the 2.4 to “not connect automatically”. Otherwise my iPhone 12 seems to always connect to the 2.4 first on arrival.

But you are right, the way the driver is written the easiest way to do it would be to install it as a separate device and use a combined presence to consider both.

Assuming you have your 2.4 and 5Ghz bands on same vlan, you could set your phone to use the device mac instead of randomize mac for both of those SSID's and then configure a static address on the router for the device mac. That way it's always the same regardless of what SSID you connect to.

1 Like

Your phone connects to the 2.4GHz band first because the 2.4GHz band has much farther range and begins the negotiation process first. There is typically an option called band steering that will move you over to the 5GHz band once it becomes available. Sometimes it's called something different but should be pretty easy to find.

For Ubiquiti AP's it's the last option in this screenshot:

On Asus AXE11000 it's called Smart Connect
image

Here is an example of the 2.4GHz coverage map vs 5GHz

2.4GHz

5GHz

1 Like

Neat. Was not aware this feature existed unless you operated with the same ssid across the different bands. I will hunt for it.

I recently upgraded from a netgear R8500 to a RAX70 and now get 5g coverage into my backyard. It covered my deck before to my iPhone but my wife’s iPad Pro didn’t like it. Now it’s happy as well. Bought the new router with the intent to move the old one to the rear of the house, but the performance seems so good that the old one is still unplugged.

There may be some devices that don't play well with band steering but those are usually very old devices. If you come across any issues then you can always disable it. As part of the functionality it usually does create duplicate SSID's for both bands. Depending on the implementation it can present itself differently though.

1 Like

Hi all
I am using a combination of this device handler, Fing via IFTTT, geo fencing with the hubitat app and presence sensors in our cars.

Is there a way to set the state of this device?
via Run Custom Actions to set the state to Not Present when all other devices indicate the person associated has left?

No worries if cant do this