Problems with presence detection

Hello everybody.

I still have huge problems with my presence detection at home for my son.

For me it works quite well. Even if I have three Apple devices I only track my iPhone with iCloud3 v3.

But my son has an iPhone and an iPad. The problem is, that is only taking his iPad in the mornings to school (mobile phones must completely be turned off). In the afternoon he sometimes only takes his iPhone and sometimes takes both devices. As the wifi at school is not always accessible, I also installed a ping tracker for this device.

I can’t figure out how to get a reliable home- and away-state for him with a mix of iCloud3 and Ping.

The other problem is that all of our devices not always update their home status fast enough to open the door. So I’d like to use the wifi connection as a trigger for the door. But I want a template-condition, that the devices must have been off wifi or connected to a different wifi for a special length of time before we arrive home. I tried several templates out of this forum, but nothing worked.

I’d be really happy if someone could help me. Thanks a lot!

My parents experience the same problem with their iPhones. I’ve tried the same things as you, and I hope that someone replies here with a new idea.

Similar phone problems here. I have a BLE tag on my keyring which usually gets picked up just as I reach the door - sometimes too soon, when I’m driving past looking for a parking space.

You might have a look at the Bayesian integration, which would allow you to calculate the probability of your son arriving home, based on a wider range of factors - time of day and day of the week, for example, as well as wi-fi connection history, iCloud3 and ping. I use this to determine whether the house is occupied (not the same as individuals arriving home, admittedly) and it’s very accurate. There’s a good post about it here.

That is really interesting to read.

I thought about solving the problem like this but can’t figure out how to do it in HA:

Trigger:

  • iPhone or iPad or Ping → state change (but not from unknown or unavailable)
    Action:
  • set input-select (or anywhere in future a template sensor)
    → This works already!

But I want a template condition that the previous state must have been active for at least 5 minutes (or more). Until now I wasn’t able to find out how to do this.

For the main entrance I want to open the door when his wifi connects back home. But only if the ipad has been offline (must be ping because of no cellular) for at least 30 minutes. Here I have the same problem with the template condition.

What about if either is connected to your WiFi network? With Ubiquity (Unifi) you have the option. Not sure if that will help.

That’s how I do it

 binary_sensor:
  - name: "Daves Samsung Galaxy Home"
    unique_id: daves_samsung_galaxy_home
    state: >
      {{ states('sensor.daves_samsung_galaxy_wifi_connection') == "MySSID" }}

Binary sensor is on when connected to our home wifi and off when not.

Thanks for the wifi-idea.

Unfortunately I have a German Telekom Router where you get the data which devices are connected. One day no will buy the Unify one but that’s not an option right now.

I guess I figured out how to do it now with icloud3 and it will see on the next days how it works.

But still I’d love to integrate a template condition of the previous state and how long there was the previous state. Any help for that?

I also use Unifi, but I do it a bit easier. I just created a person entity called “me_wifi” and added the Ubiquiti network device tracker to it. That way, whenever I’m connected to the home wifi, that “person” shows as home, and when I’m not connected, that “person” shows away. Super easy to write automations that way.

More info: https://youtu.be/K4CEsp6tBcE

I have tons of automations and controls around the status of various things on my wifi networks, such as disabling some automations when there are devices connected to my guest network (for example, I don’t want to shut off every light and TV in the house when I leave if the babysitter is here)… But that’s a different video, and I don’t want to clutter up this thread with a bunch of advertisements. If you’re interested, browse my channel. :slight_smile:

This works without a problem with phones. I do it that way with our phones.

The problem is the iPad without cellular. So when the iPad leaves the house and the wifi-network, this doesn’t get recognised by HA because the iPad doesn’t send its “not-connected” state to HA. As long as the iPad doesn’t connect to another wifi the iPad-entities stay the same as if it would be at home. The same happens when the batteries get empty at home.

That’s why I’m using ping for that case because I don’t have a router which I can access with HA.

Is there also an option to trigger the ping immediately when the iPad connects to the home wifi like I do with the icloud v3, so a call-service to send a ping?

Hello,

i also have a problem with the unifi presence detection. Yesterday i installed the unifi integration and configured it for the iPhone of my wife and me. From the presense status I want to create a persence card on my dashboard. Today I found out that the presence status of the phones is switching in short sequences also we are at home. Any idea how to fix this issue?

Example config for one of the phones in unifi integration

Status of device tracker for my phone

BR
René

Why ping? This is literally the reason device trackers were created.

Try increasing the timeout on your integration for tracking. I use 120 seconds and it’s pretty stable.