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

iCloud3 v1.1.0 beta 7 is now available. Get it here

Change log:

  • Added retry FmF location data refresh if the last refresh was not successful
  • Change the way FmF data is checked to see if it is valid
  • Added FmF refresh status messages
  • Will reuse previous FmF location data if it was refreshed less than 5-seconds ago rather than doing another refresh
  • Changed the HA log info messages for consistency
  • Fixed problem issuing an iCloud3 Restart command

Trying again on a fresh install. I have added all files into the icloud3 folder. When I do a restart of HA I get the notification on my iphone that someone is trying to login and the pin code but I do not see anything in HA to enter that code.

What could I be missing?

Pulled out device_tracker-fmf_data_trace.py file, updated device_tracker.py and restarted without error. :+1:

.storage/lovelace icloud3 log window UI config:

type: 'custom:icloud3-event-log-card'
title: iCloud Event Log
icon: 'mdi:information-outline'
cards:
  entity: sensor.icloud3_event_log

Headed out soon. Got my fingers crossed. Enjoy building you new box today. I enjoy building new computers. Getting them running right, well not as much.:astonished:

1 Like

Iā€™m also having this authorization issue. I canā€™t make it work and I canā€™t disable 2FA for my Apple ID as Apple doesnā€™t allow to do so anymore. Is there any solution?

I would only need it for the lost_iphone service. Iā€™m not using the geolocation or any other feature of it.

ERROR (Thread-19) [pyicloud.base.http] Failed to validate the credentials from cookie
ERROR (Thread-19) [custom_components.icloud3.device_tracker] Error authenticating iCloud Service for [email protected]/me
ERROR (Thread-19) [custom_components.icloud3.device_tracker] Error returned from pyicloud: ('Invalid email/password combination.', PyiCloudAPIResponseError('Failed to validate the credentials from cookie',))
ERROR (Thread-19) [custom_components.icloud3.device_tracker] iCloud location service has been disabled
ERROR (Thread-19) [custom_components.icloud3.device_tracker] iCloud3 Setup Aborted, no devices to track

icloud didnā€™t run while we were away. mobile_app device_tracker was able to track zone changes, but iOS app and icloud3 didnā€™t appear to communicate. I was unable to Refresh the event log window. device_tracker.gary_phone did not change state through several zone changes. Did find one of these in the ha log:

2019-07-26 12:12:16 ERROR (MainThread) [homeassistant.components.device_tracker] The see service is not supported for this entity device_tracker.gary

device_tracker.yaml has tracked device configured as gary_phone. gary is the device name listed in Settings on the iPhone and device_tracker.gary is the mobile_app device name.

Sounds like you are running v1.5 & v2 of the HA ios apps. I havenā€™t set up ic3 to work with v2. Things kept changing with v2 and They kept promising being able to specify the devicename for the device like in v1.5. I donā€™t think they will ever do it. Major design flaw in my opinion.

Ic3 only monitors the device specified in tracked_devices (entity device_tracker.gary_phone)ā€¦ so the device_id I n iOS app v1.5 is gary_phone. Any other device name [gary) will not be picked up.

iOS app 1.5 has an event log (bottom of the settings screen) that shows zone triggers (you probably know that). The icloud3_event_log custom card shows those triggers as they are picked up.

There must be a conflict with device names somewhere so ic3 isnā€™t monitoring the correct device_tracker entity.

There is no solution. Find my friends does not support Lost Phone service. Only the find my phone supports it and that requires 2fa.

Thatā€™s the problem then. Iā€™m running v2 build 62 only. Iā€™ll back icould3 out until the release build of v2 is out and youā€™ve updated icloud3 to work with it.

Thanks Gary.

You may be able to run v1.5 and v2. Set the v1.5 device Id to gary_phone and let that version issue zone triggers. If tracked_devices is also gary_phone, ic3 will pick up the zone trigger.

If you have device_tracker.gary for v2, try just gary as the tracked_device and see if v2 triggers are picked up.

You will get a notification about every half-hour that someone has logged into your iCloud account with a pin code (that you canā€™t do anything with) when you use the Find-my-Phone (fmphn) tracking method. The current beta has added the Find-my-Friends (fmf) tracking method to eliminate this. The ReadMe describes how to set it up.

1 Like

I got the following error after installing icloud3
What do I need to do to make it work?

2019-07-30 00:37:47 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for icloud3 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-07-30 00:37:52 ERROR (SyncWorker_1) [custom_components.icloud3.device_tracker] 'NoneType' object is not iterable
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/icloud3/device_tracker.py", line 4839, in _setup_tracked_devices_fmf
    for contact in fmf.contacts:
TypeError: 'NoneType' object is not iterable

You must add the contacts for the friends (2fa accounts) you want to track in the non-2fa account (the one in the username parameter). Each contact must gave a name (first) and the 2fa account email address. Go here, review the fmf instructions for setting it up.

Ok, it works now. Now i have this error.

2019-08-02 15:17:03 ERROR (SyncWorker_15) [custom_components.icloud3.device_tracker] ā–ŗā–ŗINTERNAL ERROR-RETRYING (_update_device_ios_trigger:iosUpdateMsg-'zone_distance')
2019-08-02 15:17:05 ERROR (SyncWorker_19) [custom_components.icloud3.device_tracker] 'timestamp'
Traceback (most recent call last):
  File "/config/custom_components/icloud3/device_tracker.py", line 3120, in _get_device_distance_data
    dev_timestamp   = attrs[ATTR_TIMESTAMP]
KeyError: 'timestamp'
2019-08-02 15:17:05 ERROR (SyncWorker_19) [custom_components.icloud3.device_tracker] ā–ŗā–ŗINTERNAL ERROR-RETRYING (_get_device_distance_data:SetupLocation-'timestamp')

Check to see if the devicename on the track_devices config parm matches the device_ tracker entity name. For example, if the track_devices devicename is ā€œgary_iphoneā€, there should be a ā€œdevice_tracker.gary_iphoneā€ entity. Looks like I need to add another error message that checks if no device_tracker data is returned from HA.

The HA ā€¦ log file shows info on the devices being tracked when it is started. Check to make sure the names match everywhere. (Track_devices parm, iOS app, iPhone name, entity registry).

I seem to have everything runningā€¦latest icloud3 and home assistant companion on my phone. Iā€™ve noticed that entering zones seems to be workingā€¦but leaving zone isnā€™t reported if Iā€™ve stayed in the zone for some period of time. If I enter at 10:24 and leave at 11:30, no reportingā€¦but when I arrive at the next zone at 11:42, itā€™s reported.

From the logā€¦
10:12 doug.iphone.zone.name1 changed to Selby

11:42 zone change has been triggered
11:42 doug.iphone.zone.name1 changed to Trader_Joes
11:42 doug.iphone.last.zone.name1 changed to Away

12:09 zone change has been triggered
12:09 doug.iphone.zone.name1 changed to away
12:09 doug.iphone.last.zone.name1 changed to Trader Joes

Where is the leaving zone message when I left Selby? The enter/leave Trader Joes is what I expected to happen. clearly, thereā€™s something missingā€¦how did Selby suddently become Away?

Can you explain?

In the track_devices devicename is tp_iphone, and i have device_tracker.tp_iphone

IOS App name    -- tp_iphone
entity registry: device_tracker.tp_iphone       mobile_app
2019-08-02 22:36:50 ERROR (SyncWorker_18) [custom_components.icloud3.device_tracker] ā–ŗā–ŗINTERNAL ERROR-RETRYING (_update_device_ios_trigger:iosUpdateMsg-'zone_distance')
2019-08-02 22:36:50 ERROR (SyncWorker_18) [custom_components.icloud3.device_tracker] 'timestamp'
Traceback (most recent call last):
  File "/config/custom_components/icloud3/device_tracker.py", line 3120, in _get_device_distance_data
    dev_timestamp   = attrs[ATTR_TIMESTAMP]
KeyError: 'timestamp'
2019-08-02 22:36:50 ERROR (SyncWorker_18) [custom_components.icloud3.device_tracker] ā–ŗā–ŗINTERNAL ERROR-RETRYING (_get_device_distance_data:SetupLocation-'timestamp')

I found it, it really is devicename

@tpaulic Good. Thanks for letting me know.

BTW. What was the problem with the devicename so I can add a check for it and generate a good error message explaining the problem.

Documentation says:

The solution to eliminating this problem is to not trigger automations based on device state changes but to trigger them on zone changes. A zone and last_zone template sensor, updated by iCloud3, is used to do this. These template sensors are only updated by iCloud3 so they are not effected by incorrect device state changes. See the example gary_leaves_zone automation in the sn_home_away_gary.yaml sample file where the sensor.gary_iphone_zone is used as a trigger.

The example file is missingā€¦

I had devicename tp_iphone, but it was to be tpiphone like in iOS App.
Then device_tracker.tpiphone started working.