Track iPhones, or any device using Bonjour protocol, on the local network for Home Assistant.
This tracking method also works if the device is in deep sleep.
Based on iPhone Detect, but not limited to HA's subnet.
Uses docker manifest for multi-platform awareness.
List of supported architectures:
Architecture | Available |
---|---|
386 | ✅ |
amd64 | ✅ |
arm/v6 | ✅ |
arm/v7 | ✅ |
arm64/v8 | ✅ |
Some configuration parameters can be passed either by environment variables or command parameters.
If both are specified, command parameters will be used.
Variables | Default | Description |
---|---|---|
MQTT_USER |
Empty | MQTT's user |
MQTT_PASSWORD |
Empty | MQTT's password |
MQTT_IP |
127.0.0.1 | MQTT's server IP address |
MQTT_PORT |
1883 | MQTT's server port |
MQTT_HA_TOPIC_PREFIX |
homeassistant | Home Assistant's topic prefix on MQTT |
MQTT_LWT_TOPIC |
MQTT_HA_TOPIC_PREFIX /status |
Home Assistant's topic for MQTT Birth and Last Will and Testament (LWT) |
CONSIDER_HOME |
60 | Seconds to wait till marking someone as not home after not being seen. |
SCAN_INTERVAL |
12 | Scan time. Must be shorter than ARP cache persistence, or the device will be marked not_home. |
Command | Description | Example |
---|---|---|
-u --mqtt-user |
MQTT's user | -u mqttuser |
-p --mqtt-password |
MQTT's password | -p mqttpwd |
-i --mqtt-ip |
MQTT's server IP address | -i 127.0.0.1 |
-o --mqtt-port |
MQTT's server port | -o 1883 |
-c --mqtt-ha-topic |
Home Assistant's topic prefix on MQTT | -c homeassistant |
-b --mqtt-lwt-topic |
Home Assistant's topic for MQTT Birth and Last Will and Testament (LWT) | -b homeassistant/status |
-h --home |
Seconds to wait till marking someone as not home after not being seen. | -h 60 |
-s --scan-interval |
Scan time. Must be shorter than ARP cache persistence, or the device will be marked not_home. | -s 12 |
-t --target |
Device name of the device followed by it's IP. MUST be the last parameter! | -t "192.168.1.104" "iPhone 1" |
mqtt-iphone-tracker:
container_name: mqtt-iphone-tracker
image: ghcr.io/passific/mqtt-iphone-tracker:latest
restart: unless-stopped
depends_on:
- mosquitto
network_mode: host # Needed for mDNS
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
environment:
- MQTT_USER=mqttuser
- MQTT_PASSWORD=mqttpwd
- CONSIDER_HOME=120
command: ["-t", "192.168.1.104", "iPhone 1", "-t", "192.168.1.105", "iPhone 2"]
################################################
# Example of configuration for eclipse-mosquitto
mosquitto:
container_name: mosquitto
image: eclipse-mosquitto:latest
restart: unless-stopped
ports:
- "1883:1883" #default mqtt port
- "9001:9001" #default mqtt port for websockets
volumes:
- ./config:/mosquitto/config:rw
- ./data:/mosquitto/data:rw
- ./log:/mosquitto/log:rw
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# volumes for mapping eclipse-mosquitto's data,config and log
volumes:
config:
data:
log: