Configurator iCloud device_tracker

When configuring the iCloud Device tracker, I get the conformation code on my iPhone. But after entering the code in de front-end configurator and click “confirm”, nothing happens. Enabled error logging for the device tracker:

17-03-22 20:39:23 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=configurator, service=configure, service_call_id=139743340047832-24, service_data=configure_id=139742331536608-1, fields=trusted_device=933036>
17-03-22 20:39:30 ERROR (Thread-7) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/concurrent/futures/", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/", line 1015, in execute_service
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/", line 183, in handle_service_call
    callback(, {}))
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/device_tracker/", line 201, in icloud_trusted_device_callback
    self._trusted_device = self.api.trusted_devices[self._trusted_device]
IndexError: list index out of range


- platform: icloud
  username: [email protected]
  password: xxxxxxxxxxx
  account_name: iCloud
1 Like

Enter the number of the index here, not the code from SMS . I only had one number, “0”. It said it right on the pop up. Then I think it popped up another box where I entered the code, I might have had to restart.

I get the same. Think its because I am using full 2fa, and per the docs this is not supported by the icloud python libs yet

I had to disable 2 factor authentication for this in iCloud and it works perfectly. I do think I’m going to change to an app to track location so I can turn my 2fa back on.

jateelover is right, I used device code “0” and then entered my 6 digit verification code.

I’m testing the iCloud device_tracker in these days and I have not encountered any problems with the 2fa process. Was quite clean & fast.
By putting a small catch, the process only introduced me a confirmation device option (code sent by SMS to phone), and code numbers just popped up in my mac. Ignoring these and using the config wizard, I had no problem setting it up.

But today I just deactivated it… my updated iPhone 6S was burning the battery in 5 hours!! My usual consumption turned 3-4x doing nothing (I suppose location updates very frequently). How do you deal with it? some magical scan_interval option somewhere?

What I did to enable iCloud device_tracker with my two factor account was the same way like I did on my AppleTV 2, which doesn’t have an interface for 2FA.
First get a verification code described over here
Then append the the received code to your password in the device_tracker configuration.
The process is described over here, scroll to “What if I use two-factor authentication on a device running older software?”

Works like a charm.

edit… 15 minutes later.
Sorry, but only seems to work one time.

I made this mistake too at first - not realizing it was index number first, then 2FA code the second time.

Suggestion: some validation logic that rejects indexes over, say, 2 digits (as those will invariably be people mistakenly entering the 2FA code)

What worked for me:
-in hassio icloud window put 0 (zero) then OK (don’t close it)
-once you put that 0 and clicked OK sms will come with a code
-in hassio icloud window delete that 0 (from previous you enter) and put instead the sms code, then again press OK buton.


  1. Putting first 0 (zero) and click OK will sent a request for the SMS code to use in hassio.
  2. DO NOT use the code in the popup on the idevice screen (the one with a map:)), the SMS code is what you want.
  3. I have 2FA :stuck_out_tongue_winking_eye: and it is not important :slight_smile:

I missed this step and then the configuration option went away. I commented out all the iCloud stuff out of my config.yaml and deleted the iCloud folder…and restarted. Then uncommented, restarted and nothing. How to I get the configuration to come back?

Restart Home Assistant

Hi ! i dit this thing and it work great a couple of month then it stop working

I read somewhere that you have to re enter the code every 2 month but I can’t find how to reset the config

Thank you

I am also facing this issue. How did you solve this?

Hello, want you configure the plugin, when you restart HA, you can configure the icloud ext. in the notification panel. Put the number which you find in the messagebox ( 0 in general) and you receive a SMS with the good “code”.