iPhone device tracker on linux

I tried to get the ping_arp tracker guys interested in this as it’s an extension of what they are doing but thus far no luck.

I also tried to get the HA devs interested in this for the person device but it didn’t go anywhere.

Will keep trying; but this is my single presence detection and works great.

Hi,

I changed the code and HA accepted it. Great and thanks!

However, I now get another error:

Error setting up platform legacy
13:00 components/device_tracker/setup.py (ERROR)

I can see the entities however they do not work. Typically I get:

device_tracker.ama_iphone
not_home
source_type: null
friendly_name: Amanda iPhone detect

In known_devices-yaml I get:

ama_iphone:
  hide_if_away: false
  icon:
  mac:
  name: Amanda iPhone detect
  picture:
  track: true

In device_tracker.yaml I have:

  - platform: iphonedetect
    hosts:
      ama_iphone: redacted ip_number

I have verified that the ip_number is correct and that the phone is connected.

Do you perhaps know why this is and how I can resolve it?

I could be wrong, but it seems like you are not following the correct convention for custom components, this has changed several versions back.

I see that yours seems to point to:
custom_components/device_tracker/setup.py

The new way should be:
custom_components/iphonedetect/device_tracker.py

you can just create a new “iphonedetect” directory and move your setup.py file in it, then rename it to device_tracker.py

it would also be wise to cleanup your device_tracker directory, move it’s components to the correct folder structure and delete that directory all together so that there is no confusion.

@folrewef, I’m having the same issue with the legacy password. Were you able to get it working? I am considering moving away from using the legacy password since I have at least one other add-in that I can’t seem to get working. Wondering if that maybe the root problem.

Someone was listening…

Hi all, is anyone using this on 0.111? I just added it via hacs and put the following in my config. It appears to be running because I can see it detecting the devices in the log but it doesn’t create any device_trackers… Did I miss a step?

device_tracker:
  - platform: iphonedetect
    consider_home: 60
    interval_seconds: 6
    new_device_defaults:
      track_new_devices: true
    hosts:
      my_iphone_x_ping: 192.168.2.12
      wife_iphone_6_ping: 192.168.2.20
      daughter_iphone_6_ping: 192.168.2.24

here’s a log snippet of it apparently working:

2020-06-30 23:35:20 DEBUG (SyncWorker_5) [custom_components.iphonedetect.device_tracker] ip n output for my_iphone_x_ping is: 192.168.2.12 dev enp4s0f0 lladdr 74:1b:b2:74:73:c2 ref 1 used 0/0/0 probes 1 REACHABLE
2020-06-30 23:35:20 DEBUG (SyncWorker_5) [custom_components.iphonedetect.device_tracker] Device my_iphone_x_ping (192.168.2.12) is HOME
2020-06-30 23:35:20 DEBUG (SyncWorker_5) [custom_components.iphonedetect.device_tracker] ip n output for wife_iphone_6_ping is: 192.168.2.20 dev enp4s0f0 lladdr c8:3c:85:54:9d:81 ref 1 used 0/0/0 probes 1 DELAY
2020-06-30 23:35:20 DEBUG (SyncWorker_5) [custom_components.iphonedetect.device_tracker] Device wife_iphone_6_ping (192.168.2.20) is HOME
2020-06-30 23:35:20 DEBUG (SyncWorker_5) [custom_components.iphonedetect.device_tracker] ip n output for daughter_iphone_6_ping is: 192.168.2.24 dev enp4s0f0  ref 1 used 0/0/0 probes 4 INCOMPLETE
2020-06-30 23:35:20 DEBUG (SyncWorker_5) [custom_components.iphonedetect.device_tracker] Device daughter_iphone_6_ping (192.168.2.24) is AWAY

You didn’t. I had the same issue with this. You need to manually add them to the known_devices.yaml file.

1 Like

Thanks for pointing me in the right direction. That did it.

The known-devices.yaml for had:

daughter_iphone_6_ping:
  icon:
  mac:
  name: daughter_iphone_6_ping
  picture:
  track: false

This was because the first time I started I had track_new_devices as false because some device trackers add millions of new devices and I was trying to be careful, but created problems for myself. I changed track: to true and now it’s working.

Didn’t work for me. I have still the same problem and i don’t know how to fix it.

Screenshot_20201025-095233|230x500

Unfortunately, it doesn’t work correctly for me … My status always shows as ‘home’.
/config/configuration.yaml:

  • platform: iphonedetect
    consider_home: 60
    scan_interval: 12
    new_device_defaults:
    track_new_devices: true
    hosts:
    dev_serge_iphone_ping: 192.168.1.72
    dev_serge_ipad_ping: 192.168.1.30

In the developer panel:
[device_tracker.dev_serge_iphone_ping]
home
source_type: router
friendly_name: dev_serge_iphone_ping

Well off the top of my head you need 2 device trackers not one (iPhone and iPad). This definitely works for me.

I have two trackers, I just thought it unnecessary to indicate, both device_tracker have the same state … which cannot be, because I’m away from home (~ 50 km). There is a suspicion about the Keenetic Viva router (KN-1910) that the address is being reserved on the network (I don’t understand this, just a guess) …

Ah didn’t realise that was component config… post using code blocks!

You do need to make sure those devices are either static up or the router reserves the up address for the device.

Do they appear in known_devices.yaml? Can you show that here as well.

Yes, both device_tracker components were created automatically in /config/known_devices.yaml along with other real gps trackers, I have not edited them anymore. In the route, the addresses are static … mm, binary_sensor (platform: ping) was also made to the same addresses, but there the status changes only when using the phone.

Can you show what the known devices entry looks like. Also are there any errors in the log? You might need to enable debug logging for the component and restart HA

How do I enable debug logging for a component? In the server log only - this is:

2020-12-24 12:52:04 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for iphonedetect which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

There is also a bug in Core, but it is old, incomprehensible, it was even before the installation of the iphonedetect component …

logger:
  default: warn
  logs:
   custom_components.iphonedetect: debug

I wouldn’t have hide if away true

IPad auxiliary, not used anywhere, so added ‘hide_if_away: true’. This is what I got:

2020-12-25 09:02:05 DEBUG (SyncWorker_6) [custom_components.iphonedetect.device_tracker] Started iphonedetect with interval=0:00:12 on hosts: 192.168.1.72,192.168.1.30
2020-12-25 09:02:05 DEBUG (SyncWorker_6) [custom_components.iphonedetect.device_tracker] ip n output for dev_serge_iphone_ping is: 192.168.1.72 dev enp1s0 ref 1 used 0/0/0 probes 6 INCOMPLETE
192.168.1.72 dev wlp3s0 lladdr 6c:72:e7:2a:b3:bd used 0/0/0 probes 0 STALE
2020-12-25 09:02:05 DEBUG (SyncWorker_6) [custom_components.iphonedetect.device_tracker] Device dev_serge_iphone_ping (192.168.1.72) is HOME
2020-12-25 09:02:05 DEBUG (SyncWorker_6) [custom_components.iphonedetect.device_tracker] ip n output for dev_serge_ipad_ping is: 192.168.1.30 dev wlp3s0 lladdr 94:94:26:61:35:3b used 0/0/0 probes 0 STALE
192.168.1.30 dev enp1s0 ref 1 used 0/0/0 probes 6 INCOMPLETE
2020-12-25 09:02:05 DEBUG (SyncWorker_6) [custom_components.iphonedetect.device_tracker] Device dev_serge_ipad_ping (192.168.1.30) is HOME
2020-12-25 09:02:17 DEBUG (SyncWorker_16) [custom_components.iphonedetect.device_tracker] ip n output for dev_serge_iphone_ping is: 192.168.1.72 dev enp1s0 ref 1 used 0/0/0 probes 4 INCOMPLETE
192.168.1.72 dev wlp3s0 lladdr 6c:72:e7:2a:b3:bd used 0/0/0 probes 0 STALE
2020-12-25 09:02:17 DEBUG (SyncWorker_16) [custom_components.iphonedetect.device_tracker] Device dev_serge_iphone_ping (192.168.1.72) is HOME
2020-12-25 09:02:17 DEBUG (SyncWorker_16) [custom_components.iphonedetect.device_tracker] ip n output for dev_serge_ipad_ping is: 192.168.1.30 dev wlp3s0 lladdr 94:94:26:61:35:3b used 0/0/0 probes 0 STALE
192.168.1.30 dev enp1s0 ref 1 used 0/0/0 probes 4 INCOMPLETE
2020-12-25 09:02:17 DEBUG (SyncWorker_16) [custom_components.iphonedetect.device_tracker] Device dev_serge_ipad_ping (192.168.1.30) is HOME



2020-12-25 09:04:43 DEBUG (SyncWorker_12) [custom_components.iphonedetect.device_tracker] ip n output for dev_serge_iphone_ping is: 192.168.1.72 dev enp1s0 ref 1 used 0/0/0 probes 4 INCOMPLETE
192.168.1.72 dev wlp3s0 lladdr 6c:72:e7:2a:b3:bd used 0/0/0 probes 0 STALE
2020-12-25 09:04:43 DEBUG (SyncWorker_12) [custom_components.iphonedetect.device_tracker] Device dev_serge_iphone_ping (192.168.1.72) is HOME
2020-12-25 09:04:43 DEBUG (SyncWorker_12) [custom_components.iphonedetect.device_tracker] ip n output for dev_serge_ipad_ping is: 192.168.1.30 dev wlp3s0 lladdr 94:94:26:61:35:3b used 0/0/0 probes 0 STALE
192.168.1.30 dev enp1s0 ref 1 used 0/0/0 probes 4 INCOMPLETE
2020-12-25 09:04:43 DEBUG (SyncWorker_12) [custom_components.iphonedetect.device_tracker] Device dev_serge_ipad_ping (192.168.1.30) is HOME

And repetitions … only time and SyncWorker number change.

Do you have an adblocker or something like that? I’d suggest creating an issue with the dev on GitHub and posting that log there. The dev is pretty responsive.

1 Like

Thank you, your extreme comment helped me. In my router, ad blockers really worked, 3 names, you need to figure out which one. So far I turned off 2 of 3, and everything worked.