Arriving home - detecting phones which are arriving to Home

This doesn´t work for iPhones as they´re not responding to pings after a period of time not being used.
There are some solutions to “wake up” the iPhone but none of them works constant enough, at least for me.
And it´s about to know when someone is heading home to start heating/cooling instead of starting when someone already arrived home.

How did you make OH2 detect when someones home?
I’m just starting to make some automation based on who’s home.
We all have Iphone connected to Wifi when we get home, and this may be the easy way to detect this I think.

With iOS13 it‘s easier to use HomeKit and Homebridge with the openhab2-complete plugin.

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…

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…

What works for me is the icloud binding. My wife and I have iphones and I have rules that run on location for a lack of presence, ie when we are outside of a location distance, ie 200m, then if we are both away do some security stuff, cameras, lights etc.

I have a slightly different routine for when we are home, the icloud binding works but as people have said a 10 minute refresh is annoying as I could be home setting off the alarm before the 10 minute refresh. So what I have here to add is motion detection, if one motion detection sensor is triggered, (I have an external camera with it and a motion sensor in the hall), it sets an auto refresh of the icloud binding, it then bypasses the 10 minute, checks immediately and if it then detects someone is within 100m of home it then turns off all the security.

So far, barring the odd one or two occassions this has been absolutely perfect, and to be honest when it hasn’t worked, the alarm has gone off but about 10 seconds later it’s caught up and everything is turned off…

I’m happy with that as I’d rather it went off as a false alarm rather than not at all.

This is also a great idea, that you bypass the distance for some minutes.

However keep in mind that

If you send an update to the iCloud binding it won’t force the iPhones to refresh, it just only re-polls the last state which was sent to iCloud. However if your rule works like this, it is really great. Why I can’t do this, because I don’t have that much motion sensor…

I’ve used this method for quite a while and haven’t noticed any issues, in fact I’d say that I’ve never noticed that it hasn’t given me a ‘live’ update rather than a re-poll.

In real life, the motion sensor detects motion, the iphone_refresh item checks the location and then if an iphone is home it turns everything off. That all happens in a matter of a second or two so surely it must be a live refresh? My rule has a 5 second timer to allow the refresh to run and return a value but it’s worked perfectly for months like this…

However, as you say…it does rely on a motion sensor update to break the 10 minute refresh.

If you wanted this on your system a motion sensor is only a few quid, shove it pointing at the front door and that should have it. The other option is, a bit left field thinking, to have a different trigger to run a refresh, do you have a door lock, ring doorbell, doorway light that comes one, something that detects you are home???

That is a very good point I brought up in this rule example. I have a motion sensor that is pointed down the stairwell towards the front door. There are no windows in the detection area or anything that could trigger the sensor. I live on the 3rd floor with only one entrance door, so that makes it easier. My system loops until the phone logs onto the wifi. Usually works within a minute or two