iCloud3 v2.0 Device Tracker - Advanced tracking features with HA iOS App integrated monitoring (Updated)

Gary…HACS is still picking up the old release

HI, I used for a while the ios companion app, and since yesterday i started to use the icloud3 v.1.0.6 from hacs. my problem is that i have duplicated entities in known_device… I tryed to delete the wrong one but come back again after a restart. If i have understand correctly, i have/could use both (icloud3 and the companion app) but both have to have the same phone name. In my case:

  • app: iphone_di_xxx_xr
  • phone: Iphone di Xxx XR

known_device:yaml

iphone_di_xxx_xr:
  hide_if_away: false
  icon:
  mac:
  name: Iphone di xxx XR
  picture:
  track: true

iphonedixxxxr:
  hide_if_away: false
  icon:
  mac:
  name: Iphone
  picture:
  track: true

that my configuration.yaml (xxx is mine, yyy my wife):


device_tracker:
  - platform: icloud3
    username: !secret iCloud_username_xxx
    password: !secret iCloud_password_xxx
    account_name: xxx_icloud
    include_device_type: iphone
    exclude_device: iphone_di_yyy_xr
    unit_of_measurement: km
    sensor_badge_picture:
     - iphone_di_xxx_xr @ /local/xxx.jpg

  - platform: icloud3
    username: !secret iCloud_username_yyy
    password: !secret iCloud_password_yyy
    account_name:yyy_icloud
    include_device_type: iphone
    unit_of_measurement: km
    sensor_badge_picture:
      - iphone_di_yyy_xr @ /local/yyy.jpg

thanx in advance

@ghstudio I haven’t released it because I’ve been away for a few weeks. I have learned the hard way that it’s not a good idea to new versions and then leave town. I’ll make a few changes when I get back and then release it. Or I might wait until iosapp v2 is released, make the necessary updates to support it and then release v1.1 (which is probably what I’ll do).

Icloud3 is only useful if it gets notifications from home assistant companion. I have everything installed with good automation scripts and all should work…but there’s a problem.

HA Companion isn’t sending tracking information. It doesn’t trigger when I leave home zone; it triggers at some point, at which time it says I’ve left home…that could be 15 minutes or more later. Today I drove through five defined zones and only one triggered.

I’m at a loss…everything seems to be loaded right in HA Companion, IOS component tracker and IOS notify platform loaded are both checked…the zones are loaded…but very few things are triggered. Manual trigger works perfectly…there just aren’t automatic triggers.

I guess I’m in hold mode until we get something new in HA companion…unless someone has other thoughts. Given the current implementations, using icloud3 with HA companion to track entry/exit of zones just isn’t working…
.
(Do you get that I am frustrated after trying to get everything to work for weeks?)

That was my decision. iOS companion is not reliably communicating with HA with or without iCloud3. My automations that rely on zone transitions no longer function. Companion records the activity, but usually doesn’t forward it on to HA.

@ghstudio @GaryK

  1. I just read another post about the iosapp not sending zone updates to HA. It might address the issue you are having. Find it here.
  2. Using the iCloud3 ‘icloud_update’ command, you can set the iphone’s state using your own automation or script. With it, you can set the state to a zone name when you enter a zone or ‘not_home’ when you exit. Before I started monitoring the iosapp, I was using OwnTracks, nmap, and Netgear trackers to monitor my zone enter/exits and changing the iphone’s state. iCloud3 still looks at state changes and handles them as if it got the notification from the iosapp. Perhaps another location tracker would also work in your case. I’ve also read about Life360 but have never worked with it. I’ll make a note of this in the docs before the next release.

Go here info about the icloud_update command. Look for the ‘zone’ command in the description and examples. (Note: You may have to then scroll up or down a page)

I do get some zone updates and I use an _ so that “fix” doesn’t apply to my HA.

Among other issues, I found this in the log this morning…started during a 2 hour poll overnight when the phone was at home. Looks like a fmf response that isn’t being handled correctly in icloud3??

2019-08-18 00:43:15 INFO (SyncWorker_14) [custom_components.icloud3.device_tracker] Douglas:family(iphone) FmF refresh successful, FmF Id=MTE3ODcwMDc0MA~~
2019-08-18 00:43:15 ERROR (SyncWorker_14) [custom_components.icloud3.device_tracker] argument of type 'NoneType' is not iterable
Traceback (most recent call last):
  File "/config/custom_components/icloud3/device_tracker.py", line 2237, in _setup_data_fmf
    if 'batteryStatus' in location:
TypeError: argument of type 'NoneType' is not iterable

Thank you. Unfortunately, like ghstudio, my deviceid doesn’t include a dash or hyphen. back on companion build(35) everything was working. Now, I can’t get iBeacon or GPS tracking to work reliably.

I’ve found that driving around and entering zones seems to be working. Leaving zones is clearly not working…I can see (in the log) that the entering zone message is coming in and processed by icloud3, but no sign of the leaving zone supposedly sent by IOSC (I can see that IOSC knows it’s leaving the zone (I have notification of the event turned on)…but no message ever seems to arrive for processing in icloud3.

Is the message never sent? Does IOS not see the message? It’s broken somewhere. Maybe ios 2.0 will fix it??? I don’t see anyone working on an update to HA companion.

An additional area for thinking about is GPS accuracy. My phone isn’t all that sensitive, I guess, and it’s an iphone XR but I’ve loaded an app that shows GPS strength and accuracy and I see that the accuracy is often over 100 which is the cutoff for icloud3…in my home, in my car, in a store. As a result lots of inputs are thrown away. Not sure what the right answer is, but maybe 100 is too low?

One additional problem out of the hands of HA developers…FMF is not accurate and location information can be way off. Check google and you’ll see many folks reporting this issue. could be patched with wider gps cutoff option, but how wide???

@ghstudio Try the iCloud 3 configuration parameter that lets you specify the GPS accuracy you want.

gps_accuracy_threshold: 200 (or whatever number works for you)

Go here and scroll down for more information.

Gary…I’ll try 300 and see if that helps. Any thoughts why I am seeing that IOSC knows I’m leaving a zone, but that message never seems to arrive…nothing shows in icloud3 log. I have not tried IOS 2.0, but there seems to be no way, at this point, to get the beta code.

@ghstudio I assume you have looked at each entry in the iosapp event log (app settings, bottom of the screen). Touching the item brings up some detail info for the entry. Most are blank but some contain a Json string with details. Compare that to the HA … log entry to see if it has been recorded. It may help you figure what end the problem is on.

Installed IOS 2.0 with icloud3 1.1.0 on .97.0…drove around today through zones…and everything works…every zone enter/leave was detected and reported.

For what it’s worth, here’s my code:

configuration.yaml

Note: I found that stationary was creating problems on the leaving automation…I am not interested in leaving “stationary”…i want to report the last zone I entered…so I eliminated it. Similarly, I found that GPS accuracy varies more than the default 100 even when standing still, so I raised the value to 500…which seems to work.

device_tracker:
  - platform: icloud3
    username: [email protected] 
    password: mypassword
    group: family
    track_devices:
      - doug_iphone > [email protected] , doug.jpg
    stationary_still_time: 999
    gps_accuracy_threshold: 500

automations.yaml

- alias: arriving in zone
  trigger:
    - platform: state
      entity_id: sensor.doug_iphone_zone_name1
  condition:
    - condition: template
      value_template: "{{ states('sensor.doug_iphone_zone_name1') not in ['Away', 'Stationary', 'not_set'] }}"
  action:
  - service: notify.ios_doug_iphone
    data_template:
        message: > 
         ‘Doug is near or has arrived at {{states.sensor.doug_iphone_zone_name1.state}}’
         
- alias: leaving a zone
  trigger:
    - platform: state
      entity_id: sensor.doug_iphone_zone_name1
  condition:
    - condition: template
      value_template: "{{ states('sensor.doug_iphone_last_zone_name1') not in ['Away', 'Stationary', 'not_set'] }}"
    - condition: template
      value_template: "{{ states('sensor.doug_iphone_zone_name1') not in ['Statonary', 'Away'] }}"
  action:
  - service: notify.ios_doug_iphone
    data_template:
        message: >
         ‘Doug is leaving or has left {{states.sensor.doug_iphone_last_zone_name1.state}}

I’m sure those could be shortened and maybe combined…but they seem to work. Obviously, you can take any action you want…I just send the message back to my phone so I can see it working as I drive. Ultimately, it will announce my wife and my locations on our Alexa Dot’s at home…but having some trouble getting alexa_media to work…I’m testing their new version and it’s almost ready.

Not sure how useful this project will be, but it’s fun learning what home assistant can do.

1 Like

iCloud v1.1.0 Beta 8 uploaded 8/29 11:30am

The latest beta has just been uploaded. The main features are:

  • Support for the IOS App version 2
  • Overhauled error reporting and setting polling intervals for errors (iCloud account reauthorization, no location data available, gps accuracy, old location data) to try 4 times on a 15-second interval. If the problem was not resolved, try again in 1-minute, again in 5-minutes, again in 15-minutes, and finally in 30-minutes.
  • Fixed a problem with pyicloud_ic3.py component that created an errror in the log file and didn’t return any information.
  • And other minor items described in the change log .

Full Change Log is here
Full documentation is here
Review the tracked_devices parameter options here for more information about using the IOS App v2 .

Download the beta version here

Hi,

Just question, it’s normally I don’t view the phone on MAP ? is A configure zone (exemple corker) a view in dashboard my phone location (Worker) but in MAP don’t vieww (if I understand it’s noramlly because My phone is on zone)

when my phone is not in zone I don’t view thhe info on MAP :slight_smile:

this is my config :


# Tracker
device_tracker:
  - platform: icloud3
    username: ............................ 
    password: .........................
    account_name: barto_Icloud
    unit_of_measurement: km
    waze_realtime: true
    waze_region: EU
    distance_method: waze
    sensor_name_prefix:
    - iphone_xs_max @ Barto

thank’s for your help and excuse my bad english

@barto_95 My Map is not working either. Normally, it displays an icon of all of my zones and my picture at my current location. Right now, it is displaying Amsterdam and I’m really in Florida. It’s also not showing the zone icons or my location. I’m running HA 0.98.1 so something in HA is not working.

HI,

Do you have define your zone with this on your configuration.yaml :

zone:
  - name: Home
    latitude: 49.010000
    longitude: 5.1005
    radius: 5
    icon: mdi:home

When I configured this My map locate the right zone and icon but I’m not viewing my icon/picture for my phone :frowning:

I seem to recall reading somewhere that your icon won’t be displayed when in the home zone.

1 Like

That is correct… here under “Home Zone”

YEs but I’m not in Zone and the icon don’t show on map

I don’t move and icon don’t show but when a move in my car the circle with “letter” show on map but the picture no

:frowning: