iCloud3 v2.1 Device Tracker - iCloud3 v2.2 has been released (10/10/2020)

i just cancel the 2fa code it seems to still work it’s just annoying

@garywilson4 As you have probably figured out, the devicenames come from the name of the device as setup in the Settings App under General>About. There is some information in the iCloud3 documentation in the section titled "Associating the iPhone Device Name with Home Assistant using the Home Assistant IOS App.

I have found it confusing when you have the 's on the device’s name when it is converted to the iCloud account and HA. I used to do Gary’s-iPhone but now just do Gary-iPhone as the name of the device which gets converted to gary_iphone. One of your phones is probably named Stacy’s-iPhone which I would change to Stacy-iPhone to simplify things.

I installed icloud v2.0.3 and it is successfully running. But it seems icloud3 doesn’t get the updates from iOS 2.0 app? I can see in iOS 2.0 app event log that location is submitted and succeeded when exiting a zone, but there is nothing in the icloud3 logs in that timespan. Its not updating the device_tracker entity.

Config:

device_tracker:
  - platform: icloud3
    username: !secret myname_iphoneuser
    password: !secret myname_iphonepass
    group: familjen
    tracking_method: famshr
    track_devices:
      - mynameiphone > myname.png
      - mywifephone > mywife.png
    gps_accuracy_threshold: 66
    unit_of_measurement: km
    inzone_interval: 13
    stationary_inzone_interval: 12
    stationary_still_time: 20
    distance_method: calc
    create_sensors: trig

This is an example log rows, left the zone (jobbr) at 14:35:

2019-11-28 14:15:15 INFO (SyncWorker_39) [custom_components.icloud3.device_tracker] FamShr update started
2019-11-28 14:15:15 INFO (SyncWorker_39) [custom_components.icloud3.device_tracker] Myname(iphone) Device Tracking Complete, Results-BaseZone-home > Zone-jobbr, GPS-(59.300957, 15.205835), Interval-13 min, Dist-7.84 km, TravTime- (in_zone), NextUpdt-15:28:15, Located-15:15:10 (5 sec ago)
2019-11-28 14:28:00 INFO (SyncWorker_15) [custom_components.icloud3.device_tracker] FamShr update started
2019-11-28 14:28:15 INFO (SyncWorker_11) [custom_components.icloud3.device_tracker] FamShr update started
2019-11-28 14:28:15 INFO (SyncWorker_11) [custom_components.icloud3.device_tracker] Myname(iphone) Device Tracking Complete, Results-BaseZone-home > Zone-jobbr, GPS-(59.300996, 15.205888), Interval-13 min, Dist-7.84 km, TravTime- (in_zone), NextUpdt-15:41:15, Located-15:28:11 (4 sec ago)
2019-11-28 14:28:15 INFO (SyncWorker_11) [custom_components.icloud3.device_tracker] FamShr update started
...[left zone about 14:35]....
2019-11-28 14:41:15 INFO (SyncWorker_30) [custom_components.icloud3.device_tracker] FamShr update started
2019-11-28 14:41:16 INFO (SyncWorker_30) [custom_components.icloud3.device_tracker] FamShr update started
2019-11-28 14:41:30 INFO (SyncWorker_8) [custom_components.icloud3.device_tracker] FamShr update started
2019-11-28 14:41:30 INFO (SyncWorker_8) [custom_components.icloud3.device_tracker] Myname(iphone) Device Tracking Complete, Results-BaseZone-home > Zone-not_home, GPS-(59.279155, 15.213204), Interval-2.5 min, Dist-6.3 km, TravTime- (not_set), NextUpdt-15:44:00, Located-15:41:17 (12 sec ago)
2019-11-28 14:41:31 INFO (SyncWorker_8) [custom_components.icloud3.device_tracker] FamShr 

Also, I have two device tracker entities:

  • device_tracker.myname_iphone_app (created first by iOS app 2.0. I appended _app to avoid conflict)
  • device_tracker.mynameiphone (created by icloud 2.0.3)

Both are updated individually. Should i group them as a Person entity or how do i combine them?

Edit: I have renamed the iOS 2.0 app created sensor sensor.myname_iphone_last_update_trigger to sensor.myname_last_update_trigger, is this the issue? Should it be manually named sensor.mynameiphone_last_update_trigger to match the icloud3 device tracker?

@Corey_Maxim If you are using the Family Sharing tracking_method and you have 2fa turned on (which you probably have to do), you will get a notification popup you can’t do anything with every 30-minutes or so when the account is reauthorized. Than is normal for 2fa accounts.

There is a section here in the iCloud3 documentation that talks about this.

@rs443 There is some information in the iCloud3 documentation here about naming how iCloud3 works with the iOS App v2 to tie everything together.

Basically, when iC3 starts, it scans the entity registry and looks for a mobile_app that either starts with the tracked_device devicename or where the iC3 devicename starts with the mobile_app devicename. This covers the situations where iC3 is installed first or the iOS App v2 is installed first. Since your iOS App devicename does not have a suffix, it was installed first. Your iC3 devicenme will have to match that with an added suffix.

Example:
iOS App is using ‘myname_iphone_app’ so the iC3 should be ‘myname_iphone_app_2’ or ‘myname_ios_app_ic3’. Or, dropping the ‘_app’ so the iOS name is ‘myname_iphone’, then the iC3 name would be ‘myname_iphone_ic3’.

In my situation, the iC3 devicename (gary_iphone) existed first so the iOS App v2 name is ‘gary_iphone_2’. iC3 looks for a mobile_app with a name starting with ‘gary_iphone’, finds ‘gary_iphone_2’ and ties them together.

1 Like

Thank you, that was a good explanation!

I can easily rename the myname_iphone_app from the Integrations page. But how do I rename (or readd with with another name) the iC3 device tracker? The entity is automatically created without an underscore (mynameiphone) with iC3 but with an underscore with app 2.0 (myname_iphone).

@rs443 You don’t readd iC3, just change the name on the tracked_devices parameter. It would look like:

  • myname_iphone_ic3 > theparametersyouareusing

Remember, if you have used ‘my_name_iphone’ for any sensors created by iC3 in any automations and scripts, you will have to change their names too.

The other option is to delete the mobile_app integration while leaving iC3 installed with the device_tracker.myname_iphone entity (look in Developer Tools>States for that entity). Then reinstall the mobile_app integration (you may have to delete and readd it to your phone). Then it’s name will be myname_iphone_2 since iC3 owns the device_tracker.myname_iphone entity.

It’s something you will just have to try to see what works best in your situation. If renaming works, good.

The other thing to consider is if you have to install the iOS App again because something got hosed. It may install with a different name ‘myname_iphone_3’ and you will have the original name and the new name in the entity registry. You will then have to delete the old unused name and then change the iC3 tracked devices name to sync with the new name and then change the automations and scripts. This scenario makes it better to have iC3 own the name (myname_iphone) and let the iOS App have it with the suffix.

Odd, I tried changing the track_devices to include an underscore, but with that configuration iC3 can’t find the devices:

track_devices:
  - myname_iphone > myname.png
  - mywife_iphone > mywife.png
2019-11-28 16:47:18 ERROR (SyncWorker_16) [custom_components.icloud3.device_tracker] iCloud Account devices, mynameiphone(Not Tracked), mywifeipad(Not Tracked), mywifeiphone(Not Tracked)
2019-11-28 16:47:18 INFO (SyncWorker_16) [custom_components.icloud3.device_tracker] Not Tracking (FamShr) > myname_iphone

The actual name of my iPhone is “Myname iPhone”. I could of course rename it and remove the space if I need.

@rs443 The iC3 name and the iPhone’s name in General>About have to match so iC3 can find it when it scans your icloud Account. The iOS App will have to be different and have with a suffix. You can try to change the device_tracker.myname_iphone that the iOS App assigned to itself but I don’t think you can. The only solution then is to delete the the integration and the mobile_app and readd it to get a new name with a suffix.

2 Likes

Thank you for the support @gcobb321! Renaming the app 2.0 devicetracker to device_tracker.mynameiphone_2 worked. iC2 now successfully match the device.

I used iCloud since the very first beta versions, keep up the good work!

@rs443 You are using the FamShr tracking method. This works fine if you do not have 2fa on your iCloud account. If you do, you will get spammed every 30-minutes or so when iC3 has to be reauthorized. More information on that is here.

2.0.3 appears as 2.0.2 in the ic3 log.

@GaryK The iCloud3 repository custom_components/icloud3 directory has device_tracker.py v2.0.3. What version do you have in your HA custom_components/icloud3 directory. I assume you updated it and restarted HA.

The version I uploaded this morning has 2.0.3 in the code, but displays 2.0.2 in the log.

VERSION = '2.0.3'     #Custom Component Updater
'''
v2.0.2
- Fixed problem calculating distance and intervals for a second zone.
- If the device_tracker.state is 'stationary' when the next update time is reached and you have moved into another zone that is not stationary, the 'zone' attribute is correct because it is based on the device's location values but the device_tracker.state is still 'stationary' instead of the zone the device is now in. This has been fixed.

@GaryK You are running v2.0.3. I posted this update at 6:30pm last night and did not update the log info in the actual device_tracker.py file. I thought you meant the iC3 Event Log.

This is the info for the updates:

  • Fixed a problem with a malformed message that displayed old location information in the Event Log.
  • Added a list of devices that are tracked and not tracked for the Family Sharing (famshr) tracking method. This is created when the iCloud account is scanned looking for the devices in the track_devices configuration parameter.

OK. Thanks.

yes, but I thought i would have to enter the f2a somewhere in HA no?

That sucks that it works that way. sometimes apple is a pain in the A _ _ !

@Corey_Maxim From what I understand, the authorization code was meant for use by apps and not for other programs that access your iCloud account. That is what lead to the changes in iCloud3 to be able to access the iCloud account using the Find-my-Friends tracking method on a non-2fa account that points to the real account.

1 Like

@tomdh76 You do not need to do anything. iCloud3 found the iOS app v2 mobile_app entry with the _2 suffix for the iCloud3 devicename in the entity registry and will monitor that device tracker for zone changes and location updates.

iCloud3 v2.0.4 has been uploaded and is now available. It is a maintenance release and fixes the following issues:

  • When the device’s location, interval and next poll information were being updated, there were times when the state was ‘stationary’ but it had actualy moved into another zone. This might be caused by zones being close together, by no zone exit notification from the ios app or by the next update trigger being processed before the zone exit trigger had been received. This caused the device’s location to be reset to the old location instead of the new location. This has been fixed.
  • Waze history data is used to avoid calling Waze for route information when you are near another device or in a stationary zone with accurate Waze route information. If you were in a stationary zone and entered another zone without a zone exit trigger, the Waze history was still pointing to the old stationary zone. The old location information was being used for distance and interval calculations instead of the new location information. A check was added to always refresh the Waze route information when the state changes.
  • Updated the iCloud3 documentation to provide more information on setting getting going and what to do if you run into trouble.

  • Complete documentation with all enhancements and breaking changes can be found here
  • Download iCloud3 v2.0.4 here
  • The iCloud3 Repository is here