You have multiple options to choose from:
- Use iCloud binding. This maybe the easiest way to go (you just need to set it up and use a generic calculate distance from Home rule), but I don’t really recommend it. This binding polls the status from iCloud and it always lags behind the actual state. So approx. you will have to wait 10 minutes to update the state if you are at home or you have gone away. So the iCloud binding is good for other automations and to see device status but not for presence I think.
- Yes you can use some ping method, which needs no other device/configuration and service to use, you can find some great example here on the forum, like this:
iPhone Presence Detection with hping3 and ARP
This is the most generic way to do, this works with every Wi-Fi connected device. However you will have to take care of all the specific cases: what happens if your phone battery dies while you are home, what if it loses Wi-Fi connection for some minutes, etc…
- Or you can use OwnTracks for this:
https://www.openhab.org/addons/bindings/mqttitude1/
I have never used this so I can’t give you additional info on this.
- But the best way in my opinion is the one @Bredmich said. Set up a HomeKit instance (you can use Homebridge or Node-RED or maybe even the openHAB HomeKit binding) and use proxy switches. Then you can set automations in the Home app for these proxy switches. One for each device and set up to turn on when that specific device arrive home and turn off when you leave home. It works really great, it works instantly, not when you approach your house and you are in wifi range, etc…