Home presense with a iPhone without using the official Home Assistant app

Hey,

I’m trying to achieve home presense with my partner’s iPhone without using the official Home Assistant app.

I’ve tried using the built-in Ping integration, but my partner’s iPhone doesn’t seem to like playing nice with Ping even with the MAC randomization turned off.

I even tried an automation like this:

alias: Iphone Ping fix
description: ""
triggers:
  - trigger: time_pattern
    minutes: /15
conditions: []
actions:
  - action: homeassistant.update_entity
    data:
      entity_id:
        - binary_sensor.192_168_50_4
mode: single

but the results are still inconsistent. This is happening even though the iPhone was connected to our Wifi during this time: Imgur: The magic of the Internet

Then I stumbled on this arctile:

I’ve created the helper and was able to expose it to my partners “Apple Home” as a switch.

The problem is that we don’t own any other Apple products that can act as a “HomeKit Hub.” If I go to the “Automation” section on my partner’s phone, I can only see a message telling me that I can setup an Apple TV or HomePod as the center of my home. Like this: Imgur: The magic of the Internet

Is there any way I can make Home Assistant act as a “centre of my home” so that the HomeKit automations would work? Or is there any other way to make the iPhone toggle the helper switch when my partner arrives home?

Look into ARP lookups.
ARP tables are a table network gear keeps updated when it sees data coming from a device.

For this to work your timeout for ARP entries needs to be low or user definable, so it can be set to 10 minutes or something there about.
Some devices already have it at a low value, but others have it set to hours.

I use pfsense as my router/firewall and it has the

> Create an ARP Table Static Entry for this MAC & IP Address pair.

option in DHCP configuration.

Are saying this would help with the Ping integration?

No, it will not help with the ping integration. This is a different way to detect presence and opposite the ping integration it is passive for the tracked device and it tracks the normal network usage that will occur with the normal usage.

You look up the ARP table entries with f.ex. a SNMP call.
The entry will say if a host is active or stale or non-existing.
If it is active, then it have been seen sending data within the ARP timeout period.

You should not make a static entry, since that would counter the function you want. :slight_smile:
I do not know pfsense that well, but I know you can do a lot and probably set up a SNMP service and configure the ARP timeout values.

I’m sorry but my simple brain doesn’t understand. Could you dumb it down a little? :smile:

Use this integration

I got working with SNMP thanks to ChatGPT! :smiley:

The ARP timeout bit too high for my liking and I’m not in the mood to fiddle with that.

This is the YAML I used:

# SNMP Sensor for detecting the ARP entry of the iPhone
- platform: snmp
  name: "Partner iPhone Presence"
  host: 192.168.50.1 # IP address of your pfSense router
  community: "public" # SNMP community string
  baseoid: "1.3.6.1.2.1.4.22.1.4.2.192.168.50.4" # Full OID for ARP entry type
  accept_errors: true
  scan_interval: 300 # Check every 5 minutes

# Template Binary Sensor for presence detection based on the SNMP sensor
- platform: template
  sensors:
    partner_iphone_home:
      friendly_name: "Partner's iPhone Home"
      value_template: "{{ is_state('sensor.partner_iphone_presence', 'dynamic') }}"

Thanks for the tip tho! @WallyR

I tried what @deluxestyle suggested and it feels like a more polished solution. I think I will go with that!

Thank you both for your help!