iCloud device tracker updates

I searched the forum but couldn’t find anything. I’m looking for a way to update the device tracker every few minutes during 3 pm and 6 pm. I was able to get the time frame working properly just not updating the iCloud device tracker.

How often does iCloud update the location by default? I only added this component last night and went out today and noticed that it seemed a 30 minute lag, with about a 10 min update window?
Like you, Id like to know more about how this component works

It’s more important how the iPhone piece works - the iPhone only updates the cloud when significant motion occurs, not on any particular schedule, so the HASS piece is limited by that.

What is considered considerable movement? When I’m on my way home it takes about 15 min worth of driving until my location is updated.

Depends how fast you are driving :wink: I don’t know - maybe google it? I am sure the question has been asked purely in the context of iCloud andFind Friends - the answer should be the same for both.

@aimc that’s not right what you’re saying. the iPhone updates it’s position a lot sooner if a request is made to call it’s location. When Find My Friends or Find My iPhone is open, your location gets updated a lot sooner.
An iPhone doesn’t push it’s location to the cloud, the cloud asks for a new location.

I’ve created a PR to replace the default tracker. It has dynamic intervals for each individual device instead of a fixed interval for all devices linked to one account. The interval is based on the state of the device_tracker entity (in a known zone or not), the distance towards home and the battery level.
It also adds 3 new services:

1 Like

Outstanding! I can’t wait for this to be implemented. Any idea when the component will be available?

Thanks for the hard work!

@Jtmoore81 The PR has been made, but it’s still under review. If you’re running the dev version of HASS, you can already use it as a custom component :slight_smile:
I’m also trying to get support for 2FA also :slight_smile:

That’s a good thing -

  1. I learned something new
  2. Happy to see improvements in iCloud presense!

Will this PR allow for timely home/not_home notifications? That was the main problem with the iCloud tracker when I tried it out.

@aimc I’m still making improvements to my version. It now supports 2FA and it will no longer be a new platform, but it will replace the icloud device_tracker itself. I made sure the current config is still valid so it can easily merge :slight_smile:

The dynamic interval will put the refresh rate of an idevice to 1 minute when you’re near your home, so the notification will be quick.
The only ‘problem’ is that when you’re in a known zone, your interval is 30 minutes. So it might take a while before you’re seen as away. I solved this for myself to use the nmap tracker as a backup at home to set my interval to 1 minute when it changes it’s state and for my work zone I created additional automations to set my interval lower (but it wasn’t that necessary, just to get a faster notification)

Out of curiosity with the new icoud device_tracker will this also update the map and if you have google maps travel time component? Right now I have an automation between 3-6pmcst that will send notification when I leave work. The zone updates but the map and the travel component only updates at about 15 min increments.

@Jtmoore81 The icloud component has nothing to do directly with the map or the google maps travel time component.
What is the interval you have for icloud now?

During my 3-6pmcst it’s every 5 min. Outside of that it’s whatever the default is.

@Jtmoore81 so you’re already using my custom version?
you’ll need to see how the interval changes as soon as you leave work, probably it will be put to 15 minutes as soon as it detects you as ‘away’, so it will only update each 15 minutes, but as you would get closer the interval will change to 5 and later on to 1.

Ok. That should work! Having accurate maps and travel times keeps my wife from asking how much longer till your home.

1 Like

@Jtmoore81 I use this automation for that:

  - alias: Bart vertrekt ergens, stuur travel time
    trigger:
      platform: state
      entity_id: device_tracker.iphonebart
      to: 'not_home'
    action:
      - condition: and
        conditions:
          - condition: template
            value_template: "{{ trigger.from_state.state != 'not_home' }}"
          - condition: template 
            value_template: "{{ trigger.from_state.state != 'home' }}"
      - delay:
          minutes: 3
      - service: notify.telegram
        data:
          message: "Bart komt thuis in ongeveer {{ states.sensor.bart_naar_huis.state }} minuten ({{ relative_time(states.sensor.bart_naar_huis.last_updated) }} geleden aangepast)."
      - service: notify.telegram
        data:
          message: "Bart komt thuis in ongeveer {{ states.sensor.bart_naar_huis.state }} minuten ({{ relative_time(states.sensor.bart_naar_huis.last_updated) }} geleden aangepast)."
          data:
            location:
              latitude: "{{ states.device_tracker.iphonebart.attributes.latitude }}"
              longitude: "{{ states.device_tracker.iphonebart.attributes.longitude }}"

I’ve noticed something odd with the new iCloud device tracker. I currently have the device tracker where the interval is every 5 minutes in the afternoon. That part works well but when I leave from work and I get about 100 yards away from my work zone the interval goes back to 30 minutes without sending the notification I have left from work. Then when the 30 min interval is up and it updates my location it updates from the location where the interval went from 5 min to 30 min. The map and the google travel sensor all have me at the location where the interval changed.

This sounds just like what I am looking for. Is this in the current hass version? I tried iCloud for location tracking, but 2FA keeps asking to enter the verification code on the device that is requesting access to iCloud. Where do you enter this code?

1 Like