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

ICloud3 relies on the ios app to detect entering and exiting a zone. The ios app updates HA and iCloud3 looks for the zone changes every 5 seconds. If the ios app does not notify HA, iCloud3 can not tell when you leave a zone and remains on 2-hour polling cycle.

Hi, I intalled Icloud3 and run perfect, but I have customize the name of the sensor in the file customize.yaml with de code ā€œfriendly_name:ā€ but donā€™t change and the ā€œunit_of_measurement:ā€ neither work.

my customize.yaml is:

sensor.iphonelauramendoza_waze_distance:
friendly_name: Distancia a Casa
unit_of_measurement: km

Hi @gcobb321 thanks for the reply, well this concerns me a little, the main reason I went with icloud3 vs standard HA is because I donā€™t have my HA instance open to the world, but it seems from reading your reply that I would need to?

Thanks

iCloud3 will work without the ios app. However, it will not be able to automatically detect when you exit and enter a zone. To detect zone exits, you might want to use another presence rector (SmartThings, owntracks, router based platform, etc). Duckdns with letsencrypt allows you to open up HA to the ios app with no apparent issues.

State gets stuck at ā€œnot_setā€ and this is repeated in the HA log. Any ideas?

Using Home Assistant 0.92.2 in Windows 10 with Python 3.6.8.

2019-05-22 18:23:35 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\concurrent\futures\thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\Administrator\AppData\Roaming\.homeassistant\custom_components\icloud3\device_tracker.py", line 1093, in _polling_loop_5_sec_device
    this_5sec_loop_second = int(dt_util.now().strftime('%-S'))
ValueError: Invalid format string

Edit: replacing strftime(ā€™%-Sā€™)) with strftime(ā€™%Sā€™)) on line 1093 seems to fix it. Bug?

Iā€™m really hoping these questions havenā€™t been asked before or are really silly but this thread is so epic Iā€™m not really able to easily find the answersā€¦

  1. Do I need to create a separate device_tracker for my wifeā€™s icloud account, or should her phone get imported into home-assistant given that sheā€™s someone Iā€™m currently ā€œfollowingā€ in Find Friends? So far my device tracker in HA has taken on the icloud3 attributes but no sign of my wifeā€™s having done the same. Both iPhone 6S.

  2. Does the icloud3 integration work with the beta iOS app? Iā€™m a bit worried that it relies on the iOS app for zone entries/exits because the iOS app still has open bugs around location tracking and because my home/work are so close together (just a block away from each other) Iā€™ve been having lots of trouble with the tracking in the iOS app (beta and non-beta) deciding Iā€™m home when Iā€™m still at work. Isnā€™t this likely to mean it causes problems for the icloud3 component or is that kind of precisely the point? It wonā€™t - due to the fact the icloud3 component discards probably erroneous GPS updates?

THANKS

Well, this is sad, cause I though iCloud would use the Find my Phone to keep track without the need for the HA app. Will have to check abut using DuckDNS, on another note, the device name on the HA app should be the one that icloud3 sees or the real iPhone nameā€¦ The reason Iā€™m asking is, HA app sees joaos_iphone but iCloud3 turns this into joao_siphone not sure why.

Thanks for all the help.

iCloud3 passes the iPhone name through the same filter that HA does that removes punctuation and conveys some special characters into underlines. Not sure why they would be different. I had ā€˜garyā€™s-iphoneā€™ that would be made into ā€˜garys_iphoneā€™ until I decided to just go with ā€˜gary_iphoneā€™ for consistency across devices and computers and to make sure HA Gave me the name I wanted.

The first version of iCloud3 did not this into the ios app but used a combination of owntracks, SmartThings and a netgear device tracker platforms to tell when I left and arrived home with limited success. That is why I tied into the ha ios app. I also put in a Beacon but found its limited range to also be unreliable.

Right now, version 1.5x of the ios app is the only one that works. The new app that is in beta testing has some serious design flaws where the device name is automatically assigned by the app and it is a 32-character name that cannot be changed. It is impossible to tell one device from another if you have several devices in your family you are tracking. It also uses a number suffix for the many sensors it creates that are not consistent across sensors. For example, sensor.geocode_location_2ā€™ might refer to one device while ā€˜sensor.last_update_2ā€™ refers to another. The HA guys working on all the mobile device platforms have said that customizing the device names will be addressed in an upcoming update but it keeps getting delayed while they work on other things. It is a beta version so that is to be expected I suppose.

1 Like

Iā€™m running iCloud3 successfully on HA 93.1 with iOS Companion beta 2.0 (35). I am staying on build 35 until sensor naming conventions are complete.

Thats what I though too, until I saw on my sensor.device tracker my phone which is Joaoā€™s iPhone become joao_siphone and in the HA is joaos_iphoneā€¦ Thats what got me confusedā€¦ :frowning: I think I need to erase all my devices and start fresh.

So if I understood correctly I should trust what HA iOS app will define when installed?

thanks

When my wife leaves home the update stops working and are retried forever. After an hour or so it works decently again. Any ideas? My phone with the same setup works flawlessly. Both phones have IOS app setup the same.

2019-05-25 11:38:45 INFO (SyncWorker_2) [custom_components.icloud3.device_tracker] Wifes(iphone) Updating, iCloud Update, NextUpdate Time
2019-05-25 11:38:45 INFO (SyncWorker_2) [pyicloud.base] Authenticating as [email protected]
2019-05-25 11:38:47 INFO (SyncWorker_2) [pyicloud.base] Authentication completed successfully
2019-05-25 11:38:47 INFO (SyncWorker_2) [custom_components.icloud3.device_tracker] Reauthenticated iCloud account for Wife/Wifesiphone
2019-05-25 11:38:47 INFO (SyncWorker_2) [custom_components.icloud3.device_tracker] Wifes(iphone) not updated, old iCloud location data, Age 18.7m, Retry #1
2019-05-25 11:39:00 INFO (SyncWorker_19) [custom_components.icloud3.device_tracker] Wifes(iphone) Updating, iCloud Update, NextUpdate Time
2019-05-25 11:39:00 INFO (SyncWorker_19) [custom_components.icloud3.device_tracker] Wifes(iphone) not updated, old iCloud location data, Age 18.9m, Retry #3
2019-05-25 11:39:15 INFO (SyncWorker_14) [custom_components.icloud3.device_tracker] Wifes(iphone) Updating, iCloud Update, NextUpdate Time
2019-05-25 11:39:15 INFO (SyncWorker_14) [custom_components.icloud3.device_tracker] Wifes(iphone) not updated, old iCloud location data, Age 19.2m, Retry #5
2019-05-25 11:39:30 INFO (SyncWorker_5) [custom_components.icloud3.device_tracker] Wifes(iphone) Updating, iCloud Update, NextUpdate Time
2019-05-25 11:39:30 INFO (SyncWorker_5) [custom_components.icloud3.device_tracker] Wifes(iphone) not updated, old iCloud location data, Age 19.4m, Retry #7
2019-05-25 11:39:45 INFO (SyncWorker_11) [custom_components.icloud3.device_tracker] Wifes(iphone) Updating, iCloud Update, NextUpdate Time
2019-05-25 11:39:45 INFO (SyncWorker_11) [custom_components.icloud3.device_tracker] Wifes(iphone) not updated, old iCloud location data, Age 19.7m, Retry #9
.....
2019-05-25 11:56:45 INFO (SyncWorker_16) [custom_components.icloud3.device_tracker] Wifes(iphone) Updating, iCloud Update, NextUpdate Time
2019-05-25 12:07:00 INFO (SyncWorker_14) [custom_components.icloud3.device_tracker] Wifes(iphone) not updated, old iCloud location data, Age 46.9m, Retry #227
2019-05-25 12:07:15 INFO (SyncWorker_12) [custom_components.icloud3.device_tracker] Wifes(iphone) Updating, iCloud Update, NextUpdate Time
2019-05-25 12:07:15 INFO (SyncWorker_12) [custom_components.icloud3.device_tracker] Wifes(iphone) not updated, old iCloud location data, Age 47.2m, Retry #229
2019-05-25 12:07:30 INFO (SyncWorker_12) [custom_components.icloud3.device_tracker] Wifes(iphone) Updating, iCloud Update, NextUpdate Time
2019-05-25 12:07:30 INFO (SyncWorker_12) [custom_components.icloud3.device_tracker] Wifes(iphone) not updated, old iCloud location data, Age 47.4m, Retry #231
2019-05-25 12:07:45 INFO (SyncWorker_10) [custom_components.icloud3.device_tracker] Wifes(iphone) Updating, iCloud Update, NextUpdate Time
2019-05-25 12:07:45 INFO (SyncWorker_10) [custom_components.icloud3.device_tracker] Wifes(iphone) not updated, old iCloud location data, Age 47.7m, Retry #233


device_tracker:
  - platform: icloud3
    username: !secret wife_iphoneuser
    password: !secret wife_iphonepass
    account_name: wife
    include_device_type: iphone
    gps_accuracy_threshold: 66
    unit_of_measurement: km
    inzone_interval: 15
    stationary_inzone_interval: 10
    stationary_still_time: 15

As you can see by the ā€˜ageā€™ in the log, the location data being received by iCloud3 is old. For some reason, the iCloud Find-my-Friends is having issues locating the phone.

You could try the following:

  • Do a Find-my-Friends from the app to see try to refresh the phoneā€™s location.

  • Power it off and back on.

  • Check location tracking to be sure it is turned on.

1 Like

After countless hours of troubleshooting I figured out the issueā€¦ It turns out my wife occasionally turns of the cellular data on her phone :rofl:

Just noticed in device.tracker.myphone:

last_located: 2:38:15
last_update: 6:38:20
next_update: 8:38:15

last update and next_update seem to be in GMT, last located is local time (my local time is GMT -4)

I rebuilt my hassio SD card recently (based on hassio operating system) and had the same issue with the new image but the old image based on rasbian was OK. The hassio log file times are also always in utc time instead of local time.

I have updated iCloud3 to fix this problem but havenā€™t posted it yet. Send your email address to [email protected] and Iā€™ll send you a pre-release version to try out.

I have HA Assistant on my iphone now communicating with HASS. I have zones set up and they are loaded to HA Assistant. I have icloud3 and duckdns working and everyone finally seems to be talking to everyone nicely. The pieces are all there and presumably working.

Looking at my entities, I find device_tracker.bobs_phone ā€¦and I find device_tracker.bobsiphone.

HA Assistant has the name Bobs_phoneā€¦bobsiphone is the name I gave the phone in the Apple cloud. I have two device_trackers for the same physical device which seems a bit strange.

I want to write some automations that trigger based on entering or leaving a zoneā€¦and I have found a couple of ways suggested to do that.

One version triggers off zone changes using platform: zoneā€¦so which device tracker should I use? device_trackerā€¦ ???

The other uses platform: state and triggers off a change in sensor.bobsiphone_zone_name1 and I think that will work correctly as long as HA Assistant sends the enter/leave notifications.

As a test, I want to send a message to my iphone ā€œhey dummy, bob is entering xxxxā€ I know how to code the entering xxxx partā€¦but the question is do I notify.bob_phone or notify.bobsiphone.

Finally, which items should be on/off under location settings in Home Assistant on the iphone to make this miracle come to life?

(sorry for the multiple posts, but I am probably among the oldest individuals to ever try to implement this automation codeā€¦be gentle :slight_smile: )

  1. The device names for ha and the iphone should match.For example, on my iphone in General>Settings>Name, my iphone has Gary-iPhone, which gets converted to gary_iphone in HA and then in iCloud3. In the IOS app, I have gary_iphone as my Device Id on the settings screen.
  2. I would use sensor.bob_iphone_zone_name1 as the sensor to trigger zone changes. iCloud3 sensors filter out device wandering due to gps errors where the device_tracker.bobs_iphone does not. For more info about this, see the iCloud3 docs here.
  3. A sample notification is:
#--------------------------------------------------------------
#   Gary leaves a zone
#--------------------------------------------------------------
- alias: Gary Leaves Zone
  id: gary_leaves_zone
  trigger:
    - platform: state
      entity_id: sensor.gary_iphone_zone_name1
      to: 'Away'
      
  condition: 
    - condition: template
      value_template: '{{trigger.from_state.state != "Home"}}'
      
    - condition: template
      value_template: '{{states.sensor.gary_iphone_distance.state | float > 0}}'
    
  action:
    - service: script.gary_leaves_zone
        
    - service: notify.mobile_app_gary_iphone
      data_template:
        title: 'Gary Leaves Zone'
        message: 'From Zone {{trigger.from_state.state}} to {{trigger.to_state.state=}}, 
                  Distance={{states.sensor.gary_iphone_distance.state}}'

Thanksā€¦I decided to clean everything out and reinstall ios and icloud3. Not sure where the device name difference came fromā€¦but itā€™s now gone and I have one device.tracker for my phone. I also went back and checked everything related and found that home zone lat/lon was incorrect. Clearly, less bourbon when coding is in the cards.

One comment on docsā€¦on github, if one copies your services.yaml file you get an error because there are two ā€œcommand:ā€ statements. not commented out. I just eliminated all the commands except waze: onā€¦

Thanks for the help.

Updated to 0.94 and icloud3 doesnā€™t seem to work anymore. Component is loaded without errors but device_tracker are not updated. Anyone else seen this?

I reverted back to 0.93 so I have no logs at the moment.

Yes I found the same. Rolled back to .93.1 for now too.