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

Yep mine broke today also :frowning:

Noticed that it stoped working and when checking the logs its full of:

    if self.any_device_being_updated_flag:
AttributeError: 'Icloud' object has no attribute 'any_device_being_updated_flag'
2019-06-14 13:40:35 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/jrechena/.homeassistant/custom_components/icloud3/device_tracker.py", line 1088, in _polling_loop_5_sec_device
    if self.any_device_being_updated_flag:
AttributeError: 'Icloud' object has no attribute 'any_device_being_updated_flag'
2019-06-14 13:40:35 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/jrechena/.homeassistant/custom_components/icloud3/device_tracker.py", line 1088, in _polling_loop_5_sec_device
    if self.any_device_being_updated_flag:
AttributeError: 'Icloud' object has no attribute 'any_device_being_updated_flag'

:frowning:

Using HA 0.94.3 and I have the same issue. Would downgrading fix it?

No. See the post above.

1 Like

iCloud3 v1.0.5 is now available for download

The significant change is tracking devices when the iCloud Location Service is unavailable using the notifications from the HA ios app v1.5x. You will have to use the include_devices configuration parameter to specify the devices to be tracked. The include_device_type will not work since it is used to scan the iCloud account which is not available. The Change Log describes how it works in more detail.

More information is in the Change Log here
It can be downloaded from the iCloud3 github repository here.

1 Like

I assume this only works with ios app 1.5 and not 2.0 beta? I got to ask.

@Dayve67 That is correct. It only works with ios app v1.5. I’ve had the v2.0 beta and made some coding changes to support it but I need it to settle down and get closer to a finalized state before getting back into it.

I’m getting the following:
timestamp: 2019-06-16T13:07:35.027
interval: ●iCloudOff●
travel_time: distance: 0 calc_distance: 0 waze_distance:
last_located: 1:07:31 last_update: 1:07:35 next_update: poll_count: 0:2:0 dir_of_travel: in_zone travel_distance: 0
info: ●●● iCloud Service Disabled ●●● . speed: 0 speed_high: 0 speed_average: 0 altitude: 0
battery_status:
device_status:
low_power_mode:
authenticated: 06/16/19, 1:05:48
tracking: mirais_iphone_7
alias: mirais_iphone_7
icloud3_version: 1.0.5
event_log:

nothing seems to be updating

EDIT: Looks as if it just needed some time to think about it…now its working…thanks for the good work!

Remember, the iCloud Location Service is down so iCloud3 is not polling. It will only update it’s information when the ios app sends location notification to HA .

HI @gcobb321 thanks for the quick fix, although I’m probably still doing something wrong since I’m still getting the error:

2019-06-16 09:57:03 ERROR (SyncWorker_8) [pyicloud.base.http] Failed to validate the credentials from cookie

I’ve replaced my icloud3 on the custom_components with the 1.0.5 version.

Thanks for the help.

@rechena That is normal. iCloud3 still tries to authenticate the iCloud account when it starts, which will generate the error if it can’t be authenticated. When this happens, it then goes into the “iCloud Disabled” mode.

@gcobb321 Looks like the auto generated sensors go away if it can’t authenticate. Can you confirm this? I’m using sensors as part of my node-red automations and breaks all of them. :cry:

@InstigatorX Did you put the device names in the config file using the include_devices parameter? That must be done so iCloud3 knows what devices to track since the iCloud account can’t be scanned. The sensors are created from the devices you specify.

@gcobb321 yessir…

include_devices:                                                                                                
  - stevesiphonexsm                                                                                            
  - turtleiphone                                                                                               
  - izzy_siphonex

2019-06-16 17:46:27 ERROR (SyncWorker_13) [pyicloud.base.http] Failed to validate the credentials from cookie
2019-06-16 17:46:27 ERROR (SyncWorker_13) [custom_components.icloud3.device_tracker] Error authenticating iCloud Service for [email protected]/steve_icloud
2019-06-16 17:46:27 ERROR (SyncWorker_13) [custom_components.icloud3.device_tracker] Error returned from pyicloud: (‘Invalid email/password combination.’, PyiCloudAPIResponseError(‘Failed to validate the credentials from cookie’))
2019-06-16 17:46:27 ERROR (SyncWorker_13) [custom_components.icloud3.device_tracker] iCloud location service has been disabled
2019-06-16 17:46:27 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform legacy
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py”, line 76, in async_setup_legacy
tracker.see, discovery_info)
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/icloud3/device_tracker.py”, line 428, in setup_scanner
waze_region, waze_realtime, waze_max_distance, waze_min_distance)
File “/config/custom_components/icloud3/device_tracker.py”, line 581, in init
if self.restart_icloud():
File “/config/custom_components/icloud3/device_tracker.py”, line 669, in restart_icloud
self.device_type[devicename] = user_name[1]
IndexError: list index out of range

@ InstigatorX I assumed that devicenames would have an underscore (’_’) in them separating the name from the type (i.e., name_type). Your devicenames didn’t follow that format.

I have made the changes to iCloud3 to accept your devicename format and have posted it on the github repository. You can download it here.

@gcobb321 that did the trick. Thx.

Thanks for the reply, but I must be doing something wrong has I have no icloud entities created :frowning:
Do I need to clean something to force them to be recreated?

Thanks for the help

@rechena I’d like to help but need a little more info…

  • Have you downloaded the latest iCloud3 update (7/16 7pm) and tried it?
  • Have you specified the devicenames using the include_devices, sensor_badge_picture or sensor_name_prefix in the configuration file?
  • What are the devicenames you are trying to set up?
  • Have you looked at the HA log file for any messages?
  • Did you check the messages in HA using the circle-i under the development tools?
  • What version of HA, ios app & iCloud3 are you running?
  • Did it work before Apple changed the authorization method and broke everything?

I don’t fully understand some of the fields in icloud3. At your suggestion, I am using sensor.doug_iphone_zone_name1 as my trigger.

For testing, I’m using notify to send the following message:

‘Doug has left {{states.sensor.doug_iphone_last_zone.state}} and is now at {{states.sensor.doug_iphone_zone.state}}’

the last_zone_state seems to vary between: not_home, doug_iphone_stationary or a zone name. Is there one sensor I could check that would always say away if I wasn’t in a zone or do I have to deal with not_home and that weird stationary value?. All I want to do is to figure out if I want to say doug is leaving states.sensor.doug-… or doug is arriving at states.sensor.doug…

I also see that using your trigger suggestion, I apparently get triggered and both doug_iphone_last_zone and doug_iphone_zone are “not-home”. What’s triggering sensor.doug_iphone_zone_name1?? I don’t think it’s my phone IOS.

Maybe I just need some help understanding what values are in zone, zone1, zone2, zone3 and last_zone, last_zone1,… and when they change.

Any help appreciated.

It seems with the new version from the 16th its now showing things :slight_smile:

info: ●●● iCloud Service Disabled ●●●   . 

So this means that it will not update location? Guess we’ll have to wait for apple?

Thanks for all the great help and work on this :slight_smile:

The 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.

I can’t seem to find the example…it’s not in configuration_files.zip on github.