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.
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.
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.
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.
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') }}"