iCloud3 v3 iDevice Tracker - Version 3

v2.3.5 Bug Fix Update (2/25/2021) has just been released and is available on HACS and in the iCloud3 GitHub repository

  • Fixed a bug causing the zone’s friendly name to be displayed incorrectly that was introduced in v2.3.4. This only occurred when the zone’s friendly name is more than one word,
  • Added debug logging to the zone table load function
  • Removed obsolete and unused ‘IsOld’ variables to prevent errors when location_data(IsOld) is not available.
1 Like

Hi @gcobb321! Stumbled upon this component after the default device_tracker was not picking up on location changes until hours later, not that we’ve been leaving home much lately :slight_smile:

I configured iCloud3 a couple days ago but after being out for about an hour and a half yesterday, it didn’t detect I was away until about 80 min and registered no changes for my wife’s device (which is connected via Family Sharing). Is there an additional way to debug why location updates are not happening? I don’t see any of the “update sources” options for the Home Assistant companion app under the iOS location settings, just the ability to set location to ‘Always’:

https://gcobb321.github.io/icloud3/#/chapters/1.4-setting-up-iosapp?id=ios-app-settings

@brianhogg
The iOS App issues zone enter/exit triggers that are picked up by iC3 to enter/exit zones. iCloud3 monitors the device_tracker.[devicename}_iosappsuffix entity for those triggers.

The Event Log (Stage 3) lists the iOS App device tracker entities in the entity registry. A sample screen is here. It also shows the iosapp suffix that will be monitored.

Review those items and make sure the ios app entities are being monitored for your phones. Also look at the Event Log in the iOS App itself to see if it is issuing the triggers.

@gcobb321 thanks for the quick reply! I did try adding the event log using the raw configuration editor at the end of the file, but get the following:

Unable to parse YAML: YAMLException: bad indentation of a mapping entry at line 165, column 3: cards: ^

The icloud3-event-log-card.js is located in config/www/custom_cards. I also tried adding a new lovelace card based on the example by copying and pasting directly into the raw card editor, but getting a “No card type found” error even though there are types specified.

Will keep trying to get the logs to display and go from there :slight_smile:

@brianhogg
Here is the lovelace card I have set up using the ui-editor:

The grid on the left with device tracker info:

type: grid
cards:
  - type: glance
    state_color: true
    show_name: true
    show_icon: true
    show_state: true
    entities:
      - entity: device_tracker.gary_iphone
        name: Gary
      - entity: sensor.gary_iphone_interval
        name: Interval
      - entity: sensor.gary_iphone_zone_distance
        name: Distance
      - entity: sensor.gary_iphone_travel_time
        name: TravTime
      - entity: sensor.gary_iphone_next_update
        name: NextUpdt
  - type: glance
    entities:
      - entity: input_boolean.gary_driving_flag
        name: DrivingFlag
        tap_action:
          action: toggle
      - entity: sensor.gary_iphone_dir_of_travel
        name: Direction
      - entity: sensor.gary_iphone_travel_distance
        name: TravDist
      - entity: sensor.gary_iphone_last_located
        name: Located
      - entity: sensor.gary_iphone_last_update
        name: LastUpdt
  - type: entities
    entities:
      - entity: sensor.gary_iphone_info
        name: Info - Gary
        icon: 'mdi:information-outline'
  - type: glance
    entities:
      - entity: device_tracker.lillian_iphone
        name: Lillian
      - entity: sensor.lillian_iphone_interval
        name: Interval
      - entity: sensor.lillian_iphone_zone_distance
        name: Distance
      - entity: sensor.lillian_iphone_travel_time
        name: TravTime
      - entity: sensor.lillian_iphone_next_update
        name: NextUpdt
    show_icon: true
    state_color: true
  - type: glance
    entities:
      - entity: input_boolean.lillian_driving_flag
        name: DrivingFlag
        tap_action:
          action: toggle
      - entity: sensor.lillian_iphone_dir_of_travel
        name: Direction
      - entity: sensor.lillian_iphone_travel_distance
        name: TravDist
      - entity: sensor.lillian_iphone_last_located
        name: Located
      - entity: sensor.lillian_iphone_last_update
        name: LastUpdt
  - type: entities
    entities:
      - entity: sensor.lillian_iphone_info
        name: Info - Lillian
        icon: 'mdi:information-outline'
  - type: entities
    entities:
      - script.ha_restart_home_assistant
columns: 1
square: false

And for the Event Log on the right:

type: grid
cards:
  - type: 'custom:icloud3-event-log-card'
square: false
columns: 1

@gcobb321
Is there a trick to getting the custom card to work? From the docs I manually copied the icloud3-event-log-card.js to config/www/custom_cards/ then added it as a new resource under Configuration > Lovelace Dashboards, Resources tab:

But when trying to add the event log via the code above, I’m getting:

Custom element doesn't exist: icloud3-event-log-card.

There’s a few threads that just state not to use a hyphen before type: (which you didn’t) and that /local is a virtual directory that points to config/www/ (where the file is), so not sure what else could be wrong in this case.

Will try the other grid card shortly to see if that’ll show the details, though I’m guessing the log will give some insight as to why it’s not updating :slight_smile:

EDIT: It’s a 404 trying to load http://192.168.0.40:8123/local/custom_cards/icloud-event-log-card.js - then noticed I missed the 3 in the url. My bad!

@brianhogg
I can understand the confusion. The screen shot with the resource url was wrong (I have just corrected it). It should be /local/custom_cards/icloud3-event-log-card.js. The screen shot shows ...icloud-... when it should be ...icloud3-....

Update the Configuration > Lovelace > Resources to local/custom_cards/icloud3-event-log-card.js and you should be fine.

@gcobb321 no worries, I missed that the screen shot was wrong and thought I’d just mistyped. Thanks for correcting!

I do now have the event log displaying now which is great. It did take about 2 hours for it to mark the device as away. Looking at the logs it seems a FamShr update happened a few min before I left (and marked as Home), then got an iCloud Account Authenticated (“lastauth… 1.3 hrs ago”) event 1.3 hours later, then about .7 hrs later requested the new iCloud location and marked as away.

All options were turned on under the Location settings of the companion app, with location allowed set to “Always,” though they couldn’t be toggled off (ie. on but dimmed/greyed out). So looks like it is being monitored but at a two hour interval?

@brianhogg
Not changing to Away when you leave a zone means iCloud3 is not getting the zone exit trigger from the iOS app. Check the following:

  1. The device name for the iOS app is not the same as the phone and the device name parameter. Check it at General > Name field in the iOS app.
  2. The HA mobile app integration is not installed. Install it at Configuration > Integrations.
  3. The suffix assigned to the iOS app device_tracker entities are not being recognized by icy. Check Stage 3 and Stage 4 for the entities being monitored in the Event Log.
  4. The iOS app device_tracker.[devicename]_[suffix] entities are not being updated by the iOS app. Check the Developer Tools > States for the device tracker entities to see if they show the zone name when you are in a zone and not_home when you are not in a zone.
  5. Review the iOSapp Monitor in the Event Log to see if any iOS app triggers are being detected. Check the Event Log > Actions > Show iOSapp Monitors. Look at the state change and trigger change values and times they changed.

iCloud3 v2.3.5 Update (no change to the version number)

Warning message about version number missing in manifest.json

HA 2021.3.2 displays a warning message in the HA log file that the iCloud3 Version Number was not found in the manifest.json file in the custom_components/icloud3 directory. This is a warning message that can be ignored.

You can update the iCloud3 manifest.json file:

  • Update iCloud3 using HACS or download the icloud3.zip file, unzip it into the icloud3 directory and restart HA.

Or:

  • Replace all of the lines the manifest.json file in the icloud3 directory with:
{
  "domain": "icloud3",
  "name": "iCloud3 Device Tracker",
  "documentation": "https://gcobb321.github.io/icloud3/#/",
  "issue_tracker": "https://github.com/gcobb321/icloud3/issues",
  "hdependencies": [],
  "codeowners": ["@gcobb321"],
  "requirements": [],
  "version": "2.3.5"
}

Or:

  • Ignore the Version Number warning for iCloud3 in the HA log file.

@gcobb321

  1. Verified the name in the app and the device_tracker then appeared. I edited the main device tracker with _original at the end, added brianmini to the icloud3 yaml, restarted, and now device_tracker.brianmini appears as an icloud3 entity
  2. Verified the HA mobile app integration exists and the phone (BrianMini) appears
  3. There’s a checkmark beside brianmini in “Family Sharing List devices that can be tracked” in Stage 3, and shows “brianmini > Brian Hogg, iOSAppSuffix-_original, TrkMethod-FamShr” in Stage 4
  4. By [suffix] you mean the mobile app entity I renamed before adding the icloud3? If so device_tracker.brianmini_original showed “unknown” under History (which I assume was not_home) whereas device_tracker.brianmini shows Home the whole time. Will check Developer Tools > States next time I’m away.
  5. With “Show Tracking Monitors” selected I see a couple “WillUpdate-False, No data received from the iOS app, using iC3 data”. Two of them are “Trigger-registration@11:45” at 12p and 12:30p, where 11:45 is around when I added the device. Around when arriving home there’s a “Trigger-Signaled@12:55” with WillUpdate-True, State Cange-home. and “Device Monitor > UpdateMethod-iOSAPP, UpdateREason-Signaled” also at 12:55.

EDIT: Yesterday the location wasn’t updated, but starting today it did work the last couple times I left home on my device with “FamShr Update Started (Next Update Time Reached)” or “FamShr Update Started (Next Update Time Reached (Retry))”. So I guess it’s only updating if I happen to be away during a scheduled update, vs. triggered when I leave a zone? Would not having access to Home Assistant remotely (ie. I didn’t open up port 8123 nor have a static IP) or should the updates be happening by the app connecting to iCloud and then Home Assistant pulling that down? My wife’s device on family sharing didn’t trigger an update likely due to timing.

I’ll need to create a good how-to video once I actually get this working consistently :slight_smile:

@brianhogg

  1. I have always had the iOS app able to access HA and would suspect you need to have HA 8123 open. I’ve been using the DuckDND and the HA 2-factor authentication for security.
  2. Try a manual update on the iOS app. Pull the iOS app screen down until you see the spinning wheel to issue the update to test the connection. Refer to the iOS app documentation if you have any questions about that. The manual update will be caught by iCloud3 if you have it set up correctly.

Hi Gary
I’m on the beta iOS app and I’ve noticed the last few days that the tracker hasn’t been keeping up with my movements - is this likely to be because some change in the beta app? I can post logs if that would be helpful? Thanks

@daneboom
The v2.3.6b1 beta version changes dealt with configuration/config_ic3 file handling and parameter validation, along with a simple addition for tracking from multiple zones. The changes are all related to setting up iC3 before any tracking is actually done.

You can create a log file (icloud3-event-log.txt) from Event Log > Actions > Export Log File. Email it to [email protected] and I’ll take a look at it to see if I notice anything. Are there any iC3 Errors being posted to the HA log file?

@gcobb321 strange, wonder how I am getting away status updates under my device if it requires a direct connection? I’m running on the beta Starlink connection which unfortunately doesn’t seem to allow port forwarding so if that’s a hard requirement I’ll keep trying to find some other way around.

@brianhogg
You’re getting the location updates from iCloud. The iOS app updates generate the zone enter and exit triggers, along with the location. You probably should go back over the iOS app documentation since it appears your issues are with it rather than iCloud3

1 Like

iCloud3 Development-Beta updated to v2.3.6b2

Installation Instructions

  1. Download the iCloud3 v2.3.6b# zip file from the Development-Beta directory.
  2. Unzip it into the custom_components/icloud3 directory.
  3. Restart HA.

Development-Beta Change Log:
v2.3.6b1 (2/28/2021)

  1. Revamped the way the configuration parameters are retrieved from HA, how they are processed and how iCloud3 is set up based on the parameters.
  2. Combined the processing of the parameters from configuration.yaml and config_ic3.yaml to use common routines. They are edited using common routines and invalid values are reset to the default value.
  3. The track_from_zone parameter can now accept multiple zones using the zone name or the friendly name.

v2.3.6b2 (3/9/2021)

  1. Fixed a problem where the Event Log would not display when the iOS App and iC3 Zone names contained an 's (e.g., Barry’sHouse).
  2. Updated the Event Log card version number check to support the v#.#.#b# (e.g., v2.3.6b2) numbering scheme.

@gcobb321 you’re right, a lot of the issues look like they were related to me not realizing I needed external access to Home Assistant. I incorrectly assumed HA would “pull” from iCloud which in hindsight doesn’t make sense. A big note in the “getting started” might be worthwhile for HA n00bs like me - I set up Home Assistant Cloud to sort that out since I can’t open ports with my internet.

Appreciate all the help!

Hi,

I was wondering if it was possible to see if iPhones/iPads was charging or not without the HA app?

We have some iPads in the family where we can’t install the HA app on, but it would be fantastic to see if it the power cord was plugged in or not… That way I could send a notification to myself if the battery was below 60% and not charging.

Thanks for a great add-on :slight_smile:

@diskoboy
iCloud does not report the charging state when the devices location is requested. So, without the iOS app, I don’t see how this could be done.