I was following some online tutorials to work with Presence Detection in OpenHab and one such suggestion was to use your iPhone’s online presence using ICMP and ARP pings. I have also followed another tutorial exploring OwnTracks. OK my problem is that the iPhone status still shows as being Online in PaperUI even though its switched off or away from the home (i.e. out of range from the router).
Not really helpful when you are trying to get presence detection to work
I can see other devices go offline and online when they physically don’t have any power to them.
I checked the configuration of the iPhone within PaperUI and the refresh interval is set to the default 60000. The iPhone has been disconnected from the router for a good 2 hours and the status is still showing as online.
How have other people managed to get around this problem with working with presence and being either at home or away?
Yes, that’s why you have systems that take a whole bunch of clues of varying reliability and assemble a best estimate out of all of them.
There is no One True Way, there is no Absolutely 100% sensor. Real world indeed.
Let’s look at the phone thing. A change in status from absent to present is likely to a good, but not foolproof, indicator. Remaining as present might well be unreliable - that’s fine, we can ignore that part. Exploit available information, weight it accordingly.
Are you looking on online status of your pingdevice Thing (that green label), or its online channel? Because the Thing will always show as online, but whether the phone is online or not is indicated by the online channel. I’m using it for presence detection with my android and it works pretty well.
As with almost everything to deal with home automation, it depends on what you need the presence detection for. For my purposes, I’ve experimented with all sorts of stuff over the years, PIR, BT beacons and tokens, phone presence, etc. In the end, I find that phone detection on the network is more than adequate for my purposes.
And in four years the number of times that I or my wife have left our phone at home is 1. Dealing with something that happens once in four years isn’t worth the cost and complexity of adding in all the other stuff.
Of course, YMMV and using phones as an indication of presence is not adequate. But it is not fair to say that using phones is not adequate for anyone at any time. Sometimes good enough is good enough.
Pay attention to m0rgoth’s post. The Online status of the Thing indicates that the binding is working. It does not indicate whether your phone is detected or not. For that you need to link a Switch Item to the Online Channel of the Thing and the Switch Item will show whether or not the phone is present.
if your usecase is satisfied by first yes, then it’s completely fine.
My wife forgets her’s phone like once a week or smrhting … and even if that would not be an issue, iphone 7 reacts differently than iphone SE to pings so … very often phones are home but undetected for several hours.
Not to mention phones without static IP, so you technically can’t detect if your visitors are home or not.
Anyway, if it works for you, that’s ok and I’m not saying you are wrong.
For some people it is reliable, or at least reliable enough. That’s my point. We’ve gone through several phones each over the past four+ years, sometimes iPhones (including iPhone 7) sometimes Android. When someone is home, OH sees us, every time. When no one is home, there was one time in four years where it was wrong, and that was just for a short walk where I forgot my phone.
It’s super reliable for me. Presence detection is more reliable than just about any other part of my OH integrations and rules. In fact, it’s even more reliable than when I tried to use BT to sniff the messages from my wife’s Continuous Glucose Monitor, and that is physically glued to her body.
It may not be reliable enough for you, but that doesn’t mean it can’t be reliable.
I found OwnTracks to be pretty good for accuracy too but it consumed too much battery to use “Move monitoring” all the time. So I gave up on using any GPS based presence detection. I’m sure it works great for those with beefer batteries on their phones though. “Significant change” monitoring is not good enough to detect coming home events. Sometimes it never switches over to being home at all.
BTW, OwnTracks can talk directly to OH (through myopenhab.org) without requiring MQTT using the GPS Tracker binding. To my surprise, it even shows family on the map like it does with MQTT. The only reason I’d recommend migration is it’s much easier to set up geofences and similar triggers. For new users I definitely recommend getting started with the GPSTracker binding over the MQTT approach.
I must admit I use the iCloud binding and have rules set up for zoning based on distance and direction. So for instance my home zoning from coordinates:
As my phone moves between zones it sets an item direction of travel in or out.
I then have rules set up such as Alexa telling my missus to put the kettle on if she’s home and I move from zone 4 to 3 and it’s between certain times.
The direction of travel is used if we are for instance travelling just in and out of zones constantly (it only changes when distance is >50m
I also use network binding as a backup in case iCloud change the certificate
I know, that this might be a pretty specific solution, but the Fritzbox TR064 binding (very popular German router) checks for the MAC, not the IP address.
I assume there are other options making use of the MAC instead of the IP address.
That’s why I have combined Wifi (MAC) device detection AND owntracks.
Whenever the iphone connects to my wifi, I set the location to my home location and presence goes ON.
If I leave, I check whether I am away from home (owntrack distance > 300m) and wifi OFF and Motion != changedsince x minutes leading to presence to go OFF (if now one else is in the homezone)