iCloud device tracker stops updating until restart of Home-Assistant

I’ve noticed that when a phone is away from the house for some time that Home-Assistant doesn’t properly find the phone as home again. The time it takes is unknown, which is unhelpful! A restart of the phone doesn’t help, nothing appears to be not running on the phone, Find my iPhone shows the correct GPS position. Restarting HASS fixes the problem.

It happens without fail every time that I fly, most of the times when I’m away for 24+ hours, and today I noticed that it happened to my wife’s phone after 12 hours away. Until tonight I thought it was only my phone and that it must be a misconfiguration on my side. Now I think it might be more widespread to iDevices. Anyone know of some tweaks that I can make to force a re-check? Is there something in the code that would make the component stop checking for status after X hours?

As I said in the first sentence, there is a work-around but it isn’t pretty. I hate restarting HASS to get my iDevices to show back up as home.

device_tracker:
  - platform: icloud
    username: [email protected]'
    password: 'password123'
    track_new_devices: 'no'
    interval_seconds: '30'

I’ve figured out what’s going on I think. I found another thread where @Bart274 stated:

the current icloud device_tracker uses this logic to determine the interval:

In a known zone, the interval is 30 minutes
If the distance towards home is more than 25km, the interval is equal to half that distance
If the distance is more than 10km, the interval is 5 minutes
If the distance is less than 10km, the interval is 1 minute.
For these last 3 distances, the interval is doubled if your battery is less than 33% and if the distance is still more than 3km.
So at home, the interval should be 30 minutes. You can always change it using the device_tracker.icloud_set_interval service. If you use a value for interval in the service data, it will put the interval to that fixed value until you call that service again or until your device enters or leaves a zone. If you don’t use interval in the service data, it will revert the interval back to it’s default calculated value based on the logic from above.

I believe this was what was going on for me. I was traveling some 800 miles, thus making the polling interval too long to be usable. I’ve put an automation that uses my phones presence on the network trigger the set_interval to one minute. Once the two trackers match ‘home’ then it resets the interval to the default.

Hopefully this will help someone else later on.

2 Likes