iPhone Presence detection using Network Binding

Hello everyone,

i am at a state, where i am very frustrated.
I am using openHab 5.0.2 on an RPI. I have an Android phone and an iPhone, which both of them trigger some rules, whenever they’re connected to the WiFi. Classic presence detection here.

My Android device works fine using just the ping method without any configuration changes.
My iPhone on the other hand seems to be a very difficult device.

As i learned, the iPhone goes to a sleep-mode, whenever the screen is off and is not answering to normal pings. Therefore we should install arping to give it a “knock on the door” and wake it up, before pinging it with the Network Binding.

I installed arping, added “arping” and “/etc/sbin/arping” to the Network Binding configuration. I checked iOS Wake Up on the iPhone-Thing and it still seems to not work. I increased and decreased Timeout and Retrys without any success.

Is there a way to still get a nice and reliable presence detection by pinging the iPhone? Did i do anything wrong in my setup? The item still goes offline after a few minutes of the iPhones screen being off.

Regards,
Jimmi

I’ve tried this in the past with the same issue, the iPhone seems to connect/disconnect/sleep making detection unreliable. If you use the iCloud binding you can create a thing for the iPhone that returns a location as GPS coordinates which you can calculate to be within a particular range for establishing ‘home’ vs ‘non-home’ using a rule.

I agree that when it works, it works. However, my iPhone regularly takes itself offline with a “HANDLER_INITIALIZING_ERROR, Retry finally failed” message for the iPhone Thing. Power cycling and reentering the 2FA credentials allows it to work for a few more weeks, but then it quietly dies.

Any ideas on why this is happening? (OH5.01 on RPi5)

For a quick and reliable local iPhone, iPad, Apple Watch and AirPods presence detection through Bluetooth you can easily do a pip installation of Theengs Gateway on your RPi running openHAB.

You might also have a required MQTT broker and the MQTT Binding installed, which should also allow for auto-discovery.

Full disclosure: with recent changes in iOS the unlocked property for the iPhone doesn’t currently work reliably, but this doesn’t affect the quick presence detection. Both working fine for the Apple Watch.

1 Like

If you have an Asus router I’ve found the Asus binding works quite reliably for tracking presence with iPhone’s on my home network as well. It must handle intermittent sleeping of network devices a bit better. Perhaps a sleeping client isn’t necessarily answering a network ping but still maintains a keep-alive with the router.

iPhone Presence detection using the GPS Tracker binding, the Owntracks app, and the OpenHAB Cloud Connector has been working well for me for over 4 years.
@rlkoshak has published a robust rule to put it together