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

I have been running for a couple of days now which has led to some observations/questions. I am looking at the log…I’ve actually deactivated my automation until I figure out what fields I need.

My goal is to be able to use alexa to announce when my wife or I have arrived home, left home or arrived/left any other defined zone. Doug has left home; doug has arrived at Trader Joes; doug has left Trader Joes; and so on. I’m trying to do this fun and learning, but it might be useful in some situations…

  1. Leaving a zone sometimes doesn’t trigger anything…until the next poll. In some cases, that’s not until I reach the next zone…maybe 10 minutes later…far too late to notify someone I’ve left home or trigger some action like turn off lights. OTOH, one of the zones overlaps an interstate and when I drive by on the interstate, I actually get zone change messages triggered for entering and leaving that zone…a minute apart.

  2. I can’t find any way to find the name of the last zone if you have been in it long enough for stationary to be entered in the zone name field. Stationary is actually not a useful state, at least to me…If I’m in a zone, then zone_name should be the name of the zone.

  3. I am seeing a zone_name change in the middle of the night from stationary to home.

@ghstudio

  1. iCloud3 depends on the iOS app to issue zone enter/exit notifications. It does not know if a zone has been exited without the iOS app trigger and will think it’s still in the zone until the next poll when it asks the iCloud location service for an update.
  2. You will only go into a “stationary” zone when you haven’t moved and you are not in a zone that has been set up in HA. You must be in a “not_home” or “Away” state before changing to “stationary”. The “last_zone” will be “not_home/Away”. If you are in a zone defined in HA, the zone_name is the name of the zone.
  3. Sounds like GPS wandering is setting you to “not_home” which could then put you in a stationary zone which will then move you back to the “home” zone when its accuracy improves. The docs talk about that a little here.
1 Like

Gary…thanks for the explanation…

1)So how do I trigger “left home” if IOS isn’t triggering? That has to be an IOS bug?

  1. I have to write my automation so that if I am in a defined zone and iphone zone changes , I want to trigger “leaving last_zone”…if the current zone is “away” or “stationary”, then I am arriving at zone. Challenging…but this is a learning experience.

  2. I don’t think it’s gps wander…GPS accuracy is 60…but IOS does two zone changes in the middle of the night. Very strange. For some reason, I am not seeing my location on the HA MAP…seems to have disappeared in the latest drop of Hass.

I need help. I have tried for days to get icloud3 running without luck. I have done the following:

  1. From https://github.com/gcobb321/icloud3, I have downloaded the zip file with the modules. Unpacked it and by means of Samba copied them to custom_components\icloud3.
  2. From the github beta, copied device_tracker.py and pyicloud_ic3.py to icloud3, replacing the previous device_tracker.py.
  3. Checked that the device_tracker.py in icloud3 dir indeed was beta 7 (1.1.0b7).
  4. Created the following entries in config.yaml:
device_tracker:
  - platform: icloud3
    username: [email protected]       
    password: xxxxxx   
    group: family                        
    tracked_device:                
      peters_iphone > [email protected]
  1. If I now do a configuration validation, I get the following error:
|Invalid config for [device_tracker.icloud3]: [tracked_device] is an invalid option for [device_tracker.icloud3]. Check: device_tracker.icloud3->tracked_device. (See ?, line ?). Please check the docs at https://home-assistant.io/components/device_tracker.icloud3/

I am sure it must be me doing something wrong, as no one else seems to get this error, but I can’t figure out what I am doing wrong. I have even created a new test instance of hassio from the scratch, with same result. I am running on ubuntu 18.04 in docker environment.
Any ideas?

Maybe track_devices (or track_device )

Thanks! You are definitely right. - I now see what I did wrong. I copy/pasted the configuration example from the readme file, which says tracked_devices, and not track_devices.The readme file should be corrected.

@pfugl I just corrected the “tracked_devices” typo in read me examples.

Gary…I would like to eliminate the automatic move to being in a “stationary” zone so I can always check to see if last_name1 was away when I get a zone change. which would indicate that I am entering a defined zone. I believe that Stationary can change to Away so I have to tests for conditions and I’m not good at writing those conditional statements.

The easiest way I see would be to set the value for: stationary_still_time very high…eg. 9999 so I would never enter that stationary zone. What is the maximum number of minutes I can specify?

Is there a better way?

Stationary is only interesting to me if I can always find a field that tells me where I am stationary. I believe that’s not always the case (am I wrong?)

@ghstudio

  1. You can set the number to whatever seems practical since python does not have a maximum number value. There are 1440 minutes in a day so 9999 is almost a week. 9999 would work fine to turn off the stationary zone usage.
  2. As you know, The stationary zone is used to control the polling interval to conserve battery usage when you haven’t moved in a while. Since it is dynamic and not tied to a specific place like a defined zone, it doesn’t really know where you are in terms of a location name. The latitude and longitude values define your location but I don’t think that is any help to you.

Gary…HACS is still picking up the old release

HI, I used for a while the ios companion app, and since yesterday i started to use the icloud3 v.1.0.6 from hacs. my problem is that i have duplicated entities in known_device… I tryed to delete the wrong one but come back again after a restart. If i have understand correctly, i have/could use both (icloud3 and the companion app) but both have to have the same phone name. In my case:

  • app: iphone_di_xxx_xr
  • phone: Iphone di Xxx XR

known_device:yaml

iphone_di_xxx_xr:
  hide_if_away: false
  icon:
  mac:
  name: Iphone di xxx XR
  picture:
  track: true

iphonedixxxxr:
  hide_if_away: false
  icon:
  mac:
  name: Iphone
  picture:
  track: true

that my configuration.yaml (xxx is mine, yyy my wife):


device_tracker:
  - platform: icloud3
    username: !secret iCloud_username_xxx
    password: !secret iCloud_password_xxx
    account_name: xxx_icloud
    include_device_type: iphone
    exclude_device: iphone_di_yyy_xr
    unit_of_measurement: km
    sensor_badge_picture:
     - iphone_di_xxx_xr @ /local/xxx.jpg

  - platform: icloud3
    username: !secret iCloud_username_yyy
    password: !secret iCloud_password_yyy
    account_name:yyy_icloud
    include_device_type: iphone
    unit_of_measurement: km
    sensor_badge_picture:
      - iphone_di_yyy_xr @ /local/yyy.jpg

thanx in advance

@ghstudio I haven’t released it because I’ve been away for a few weeks. I have learned the hard way that it’s not a good idea to new versions and then leave town. I’ll make a few changes when I get back and then release it. Or I might wait until iosapp v2 is released, make the necessary updates to support it and then release v1.1 (which is probably what I’ll do).

Icloud3 is only useful if it gets notifications from home assistant companion. I have everything installed with good automation scripts and all should work…but there’s a problem.

HA Companion isn’t sending tracking information. It doesn’t trigger when I leave home zone; it triggers at some point, at which time it says I’ve left home…that could be 15 minutes or more later. Today I drove through five defined zones and only one triggered.

I’m at a loss…everything seems to be loaded right in HA Companion, IOS component tracker and IOS notify platform loaded are both checked…the zones are loaded…but very few things are triggered. Manual trigger works perfectly…there just aren’t automatic triggers.

I guess I’m in hold mode until we get something new in HA companion…unless someone has other thoughts. Given the current implementations, using icloud3 with HA companion to track entry/exit of zones just isn’t working…
.
(Do you get that I am frustrated after trying to get everything to work for weeks?)

That was my decision. iOS companion is not reliably communicating with HA with or without iCloud3. My automations that rely on zone transitions no longer function. Companion records the activity, but usually doesn’t forward it on to HA.

@ghstudio @GaryK

  1. I just read another post about the iosapp not sending zone updates to HA. It might address the issue you are having. Find it here.
  2. Using the iCloud3 ‘icloud_update’ command, you can set the iphone’s state using your own automation or script. With it, you can set the state to a zone name when you enter a zone or ‘not_home’ when you exit. Before I started monitoring the iosapp, I was using OwnTracks, nmap, and Netgear trackers to monitor my zone enter/exits and changing the iphone’s state. iCloud3 still looks at state changes and handles them as if it got the notification from the iosapp. Perhaps another location tracker would also work in your case. I’ve also read about Life360 but have never worked with it. I’ll make a note of this in the docs before the next release.

Go here info about the icloud_update command. Look for the ‘zone’ command in the description and examples. (Note: You may have to then scroll up or down a page)

I do get some zone updates and I use an _ so that “fix” doesn’t apply to my HA.

Among other issues, I found this in the log this morning…started during a 2 hour poll overnight when the phone was at home. Looks like a fmf response that isn’t being handled correctly in icloud3??

2019-08-18 00:43:15 INFO (SyncWorker_14) [custom_components.icloud3.device_tracker] Douglas:family(iphone) FmF refresh successful, FmF Id=MTE3ODcwMDc0MA~~
2019-08-18 00:43:15 ERROR (SyncWorker_14) [custom_components.icloud3.device_tracker] argument of type 'NoneType' is not iterable
Traceback (most recent call last):
  File "/config/custom_components/icloud3/device_tracker.py", line 2237, in _setup_data_fmf
    if 'batteryStatus' in location:
TypeError: argument of type 'NoneType' is not iterable

Thank you. Unfortunately, like ghstudio, my deviceid doesn’t include a dash or hyphen. back on companion build(35) everything was working. Now, I can’t get iBeacon or GPS tracking to work reliably.

I’ve found that driving around and entering zones seems to be working. Leaving zones is clearly not working…I can see (in the log) that the entering zone message is coming in and processed by icloud3, but no sign of the leaving zone supposedly sent by IOSC (I can see that IOSC knows it’s leaving the zone (I have notification of the event turned on)…but no message ever seems to arrive for processing in icloud3.

Is the message never sent? Does IOS not see the message? It’s broken somewhere. Maybe ios 2.0 will fix it??? I don’t see anyone working on an update to HA companion.

An additional area for thinking about is GPS accuracy. My phone isn’t all that sensitive, I guess, and it’s an iphone XR but I’ve loaded an app that shows GPS strength and accuracy and I see that the accuracy is often over 100 which is the cutoff for icloud3…in my home, in my car, in a store. As a result lots of inputs are thrown away. Not sure what the right answer is, but maybe 100 is too low?

One additional problem out of the hands of HA developers…FMF is not accurate and location information can be way off. Check google and you’ll see many folks reporting this issue. could be patched with wider gps cutoff option, but how wide???

@ghstudio Try the iCloud 3 configuration parameter that lets you specify the GPS accuracy you want.

gps_accuracy_threshold: 200 (or whatever number works for you)

Go here and scroll down for more information.

Gary…I’ll try 300 and see if that helps. Any thoughts why I am seeing that IOSC knows I’m leaving a zone, but that message never seems to arrive…nothing shows in icloud3 log. I have not tried IOS 2.0, but there seems to be no way, at this point, to get the beta code.