iCloud custom_component device tracker that will not drain your battery

Yes, if we get some good feedback from testing, I’ll put together a pull request to update the main branch.

I would like to try the icloud custom_component. I would like to ask about account_name

device_tracker:
  - platform: icloud2
    username: !secret icloud_username
    password: !secret icloud_password
    account_name: !secret icloud_descriptive_name  <== this can be any name or has to match the phone name?
    filter_devices: 'phone'

Same as in the docs: iCloud - Home Assistant

account_name (Optional): The friendly name for the account_name. If this isn’t given, it will use the account_name of the username (so the part before the @ in the email address).

1 Like

Thank you very much.

Earlier I used icloud but I had stop it because battery drainage and lack of gps display correctly.

Currently, owntracks and nmap.

after restart. On front end icloud ask me to configure. I have allow from iphone and put the code in configure, restart HA.

HA always ask me to put the code which I already has put. o.O’

icloud setup info is lacking,

Basically, once you restart Ha the first time, you will get the popup on your phone to allow, click ok and then you phone will give you a code, disregard the code.

Next go to Ha, click the Ha icloud configure and put in 0 and submit ( the number Zero or Zed )

You’ll then get a txt message on your phone with a code, ( or a call with a code) , use that code and input it in the Ha icloud configure that should now be asking for a code.

5 Likes

Million thanks. I got struck with this verify since icloud. Now I can use it. device_tracker shows correctly that I’m home.

Before always show not_home.

Getting the following in the log.

2018-02-06 19:58:52 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/ha/.homeassistant/custom_components/device_tracker/icloud2.py”, line 321, in keep_alive
if (self.filter_devices in devicename):
TypeError: ‘in ’ requires string as left operand, not NoneType

Try adding filter_devices to your config. It’s currently required.

That did it thanks!

I don’t see your code in hastebin anymore?

I had this issue last night for some reason. Not sure why it disappeared for 15 minutes or so, it was back up later. Seems like a hastebin issue.

I have it on my github if you want it right away. Its the V1.1.

https://github.com/SilvrrGIT/HomeAssistant/blob/master/custom_components/device_tracker/icloud2.py

@Maaniac @silvrr That looks like the original version you linked there – Here’s the v1.1 moved over to Github:

This component is only picking up tracking information for only my phone. How do I add other devices on my account so they too can be tracked?

I have my wife’s phone integrated into my HA and it continues to work with this new component.

I used to have her as a separate instance but she didn’t like when I made a change and the verification needed to be completed again.

Then I noticed that as we have our locations shared through “share my location” (settings - privacy - location services) that her phone and watch are tracked through the HA component also. Her watch does not appear to be tracked with the new instance, I assume this is due to the filter for ‘phone’. I don’t use her watch for any automations so it works for me.

@silvrr I also have my wifes phone tracked on FMF and in FMP but neither are appearing in HA using this component. So far it’s only tracking my phone.

You need to have iCloud family sharing turned on and have her device named something like “Wife’s Phone” that matches the filter. FMF (Find my Friends) is not currently supported by the underlying library, pyicloud.

Presume this does not work with 2fa turned on? I read that some time ago when i played with it.

It does work with 2FA, the documentation is out of date!

Ouch, last time i did check it, it would also require to authenticate every month or so again. If you have any insights/docs regarding it, would be appreciated.