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

See if you get the error again next time you restart HA … .

Edit: Also wonder if you get it if you change the Entity ID on the Integrations screen to last _update _trigger _2 and then restart HA …

I did quite a few times, it doesn’t happen every time. Seems like maybe when icloud3 loads first then when the mobile app initializes it errors out when setting the state to that sensor back on startup?

You can see below the icloud3 initializes that sensor then later the mobile app tries to do the same thing and it gets the error.

2019-10-30 00:50:00 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.last_update_trigger, old_state=None, new_state=<state sensor.last_update_trigger=iCloud3@12:50:00 @ 2019-10-30T00:50:00.347447-05:00>>

-----

2019-10-30 00:50:13 INFO (MainThread) [homeassistant.setup] Setup of domain sensor took 1.6 seconds.
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=sensor>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event platform_discovered[L]: service=load_platform.sensor, platform=circadian_lighting, discovered=>
2019-10-30 00:50:13 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.zwave
2019-10-30 00:50:13 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.hue
2019-10-30 00:50:13 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.hue
2019-10-30 00:50:13 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.hue
2019-10-30 00:50:13 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.plex
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event platform_discovered[L]: service=load_platform.sensor, platform=hacs, discovered=>
2019-10-30 00:50:13 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.mqtt
2019-10-30 00:50:13 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.mobile_app
2019-10-30 00:50:13 INFO (MainThread) [homeassistant.components.hue.sensor_base] Starting sensor polling loop with 5.0 second interval
2019-10-30 00:50:13 INFO (MainThread) [homeassistant.components.hue.sensor_base] Starting sensor polling loop with 5.0 second interval
2019-10-30 00:50:13 INFO (MainThread) [homeassistant.components.hue.sensor_base] Starting sensor polling loop with 5.0 second interval
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.bootstrap] Setting up {'camera', 'owntracks'}
2019-10-30 00:50:13 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.circadian_lighting
2019-10-30 00:50:13 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.hacs
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.floors_ascended, icon="">>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.sim_1, icon="">>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.battery_state, icon="">>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.floors_descended, icon="">>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.sim_2, icon="">>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.average_active_pace, icon="">>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.bssid, icon="">>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.steps, icon="">>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.ssid, icon="">>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.activity, icon="">>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.distance, icon="">>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.connection_type, icon="">>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.geocoded_location, icon="">>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.battery_level, icon="">>
2019-10-30 00:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.hacs, icon="">>
2019-10-30 00:50:13 INFO (MainThread) [homeassistant.components.switch] Setting up switch.mqtt
2019-10-30 00:50:13 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 399, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: sensor.last_update_trigger. Platform mobile_app does not generate unique IDs

I’ll probably poke at it more tomorrow.

I’ll look at putting in a delay on the iCloud3 setup process to let the mobile app finish loading before I update the last update trigger the first time. It only updates it early so any mobile app triggers that cause a state change won’t be missed.

Send me your email address and I’ll send you the code to try before I update the repo. [email protected]

Getting a lot of these this morning following an HA restart.

2019-10-30 06:00:50 ERROR (SyncWorker_11) [custom_components.icloud3.device_tracker] Error setting up info attribute-tuple index out of range
2019-10-30 06:11:20 ERROR (SyncWorker_3) [custom_components.icloud3.device_tracker] tuple index out of range
Traceback (most recent call last):
  File "/config/custom_components/icloud3/device_tracker.py", line 4619, in _format_info_attr
    info_msg = '{} ●Poor.GPS.Accuracy, Dist-{}m'.format(info_msg)
IndexError: tuple index out of range

Got this on startup:

2019-10-30 04:27:44 ERROR (SyncWorker_16) [custom_components.icloud3.device_tracker] name 'retry_cycle' is not defined
Traceback (most recent call last):
  File "/config/custom_components/icloud3/device_tracker.py", line 3365, in _determine_interval_retry_after_error
    interval = self._get_interval_for_error_retry_cnt(retry_cycle)
NameError: name 'retry_cycle' is not defined

kCLErrorDomain error 5:

Although I haven’t found it documented, you are limited to 20 zones when using IOS Home Assistant Companion with icloud3. Icloud3 creates a “stationary” zone for each tracked device, so you can only have 19 (or less) of your own. I am not sure if there is a limit if running on an android device.

iCloud3 v2.0 Release Candidate #5 (10/30) is now available

Fixed the following:

  • Fixed the ‘retry_cycle’ variable error.
  • When HA starts, if it loads iCloud3 before the mobile_app, there is the chance of then getting an error related to the sensor.last_update_trigger entity for the device_tracker. iCloud3 will now delay the first update to sensor.last_update_trigger by 30-seconds to all time for the mobile_app to finish loading.
  • Changed some error messages
  • Added some daily metrics to the Event Log before they are reset at midnight.

Documentation and Download links:

  • Complete documentation with all enhancements and breaking changes can be found here
  • Download iCloud3 v2.0rc #5 here
  • The iCloud3 Development Repository is here

Didn’t see metrics, but found this in the log this morning:

2019-10-31 00:00:05 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  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 1270, in _polling_loop_5_sec_device
    self.count_update_iosapp.get.get(devicename),
AttributeError: 'builtin_function_or_method' object has no attribute 'get'

Chugging right along. Wish I had a few more cell towers around here.

@GaryK I think I have already emailed you the fix to the above problem. The above error was fixed, rolled into rc5 and release was updated. I did not bump to rc6 so just download device_tracker.py again.

Got rc5 yesterday. Haven’t seen the error recur.

iCloud3 v2.0 Release Candidate #6 (11/3) is now available

Fixed the following bugs:

  • Fixed a problem where iCloud3 would hang up in a 15-second device location update loop if no location information was returned from iCloud Location Services on the previous locate request.
  • Fixed an error created when iCloud3 was restarting to recover from a device location error.
  • If the debugging logs were on and a second base zone was being tracked and the hourly metrics report was being displayed, the length of the info sensor may be longer than the 255-character limit and generate an error message., This has been fixed.
  • Fixed a problem where the tracked devices list was not being cleared when iCloud3 was restarted.
  • Fixed a problem where the initialization stages were being run twice when iCloud3 was restarted with the service command.
  • Added metrics to the event log when iCloud3 was restarted.

I am a bit confused about the docs as it gives me errors…

I have this location and alsothis one.
As you may see the format is very different and I am not sure which is “latest”.

my config
CloudApp

error
CloudApp

I followed the instal and I have all 5 files in custom component folder…
CloudApp

Try track_devices:

no go, same error.
I tried other things like the log card and the same gives me error if I try to put it into the lovelace yaml.
spaceing is wrong it seems.

So which if the 2 links are the real documentation. Sintax is very different.

Both are applicable. The first link is current. Have you specified a tracking method?
Here’s my working device_tracker config:

  - platform: icloud3
    username: !secret icloudfmf_user 
    password: !secret icloudfmf_passwd
    group: tracking
    tracking_method: fmf
    track_devices:
      - gary8 > [email protected], hatsmall.jpg
      - gryphon7 > [email protected], cowgirl.jpg
    unit_of_measurement: mi
    gps_accuracy_threshold: 75
    stationary_inzone_interval: '30 min'
    stationary_still_time: '8 min'
    inzone_interval: '2 hrs'
    ignore_gps_accuracy_inzone: true
    travel_time_factor: .6
    hide_gps_coordinates: false
    distance_method: waze
    waze_region: US
    waze_min_distance: 1
    waze_max_distance: 9999
    waze_realtime: false
    exclude_sensors: bat,zon2,zon3,lzon2,lzone3

Are you getting the code here?(https://github.com/gcobb321/icloud3_dev/releases)

I upgraded to the latest one and then my HA would no longer start. The only logs I could produce was the initial loading of custom components. Like 6 lines in the log in total so it is not very helpful.

Check your manifest.json file. Does it look like this?

{
  "domain": "icloud3",
  "name": "iCloud3 Device Tracker",
  "documentation": "https://gcobb321.github.io/icloud3_dev/#/",
  "dependencies": [],
  "codeowners": ["@gcobb321"],
  "requirements": []
}

Yeah it seems to be the same. I have to remove the files for HA to start again.

calvin% cat manifest.json
{
  "domain": "icloud3",
  "name": "iCloud3 Device Tracker",
  "documentation": "https://github.com/gcobb321/icloud3",
  "dependencies": [],
  "codeowners": ["@gcobb321"]
}
calvin%

You need to add ‘requirements’ as shown in the example above.

1 Like

Yeah, it is working now thanks! I missed that completely.

I am having a problem with GPS accuracy throwing away information. I don’t know if it’s HA Companion Beta (latest release) or icloud3 (or somewhere else?) that’s causing the problem…but the result is that although I am sitting at home at my desk…and my iphone is telling me that it’s current accuracy is around 65’ (it varies, but never gets above 300 ft)…and icloud3 keeps telling me that the accuracy is 2323 ft.

In configuration I have:

stationary_still_time: 999
gps_accuracy_threshold: 1500
ignore_gps_accuracy_inzone: true

I can see that the iphone is being polled (polling times change), but the GPS accuracy never varies from 2323 ft.

I am using FMF…and maybe that’s causing the issue. The phone is registered to my a 2FA account so I am using a dummy FMF in the middle between IOS and HA/IOS/icloud3.

HA and Icloud3 think I am somewhere near my home (but within the home “circle” on the map)…my phone has me dead on my home (GPS)…and if I look at the HA MAP, it shows me near my home, not at my home. The accurate GPS is not getting through the software.

Note for completeness…I have wifi off on the phone so all communications is over my external phone line with a strong LTE signal

Any thoughts???