Error setting up platform icloud ... any suggestions?

Hello. I’m running H-A 0.31.1 using the RPi Image.

I can’t get iCloud to initialize and I get the following error and log file entry each time I start H-A. I’m pretty sure it worked once, but I can’t say that for certain. The only references I’ve found on this issue, point here. https://github.com/home-assistant/home-assistant/issues/1625

I’ve deleted the the following directories and restarted H-A. I still get the same error.
/home/homeassistant/.homeassistant/deps/pyicloud
/home/homeassistant/.homeassistant/deps/pyicloud-0.9.1-py3.4.egg-info

Here is the log entity:
16-11-02 12:36:40 homeassistant.components.device_tracker: Error setting up platform icloud
Traceback (most recent call last):
File “/usr/lib/python3.4/tokenize.py”, line 375, in find_cookie
line_string = line.decode(‘utf-8’)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xa2 in position 0: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/device_tracker/init.py”, line 147, in setup_platform
if not platform.setup_scanner(hass, p_config, tracker.see):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/device_tracker/icloud.py”, line 45, in setup_scanner
api = PyiCloudService(username, password, verify=True)
File “/home/homeassistant/.homeassistant/deps/pyicloud/base.py”, line 167, in init
self.authenticate()
File “/home/homeassistant/.homeassistant/deps/pyicloud/base.py”, line 186, in authenticate
data=json.dumps(data)
File “/srv/homeassistant/lib/python3.4/site-packages/requests/sessions.py”, line 522, in post
return self.request(‘POST’, url, data=data, json=json, **kwargs)
File “/home/homeassistant/.homeassistant/deps/pyicloud/base.py”, line 59, in request
callee = inspect.stack()[2]
File “/usr/lib/python3.4/inspect.py”, line 1342, in stack
return getouterframes(sys._getframe(1), context)
File “/usr/lib/python3.4/inspect.py”, line 1321, in getouterframes
framelist.append((frame,) + getframeinfo(frame, context))
File “/usr/lib/python3.4/inspect.py”, line 1296, in getframeinfo
lines, lnum = findsource(frame)
File “/usr/lib/python3.4/inspect.py”, line 663, in findsource
lines = linecache.getlines(file, module.dict)
File “/usr/lib/python3.4/linecache.py”, line 41, in getlines
return updatecache(filename, module_globals)
File “/usr/lib/python3.4/linecache.py”, line 126, in updatecache
with tokenize.open(fullname) as fp:
File “/usr/lib/python3.4/tokenize.py”, line 438, in open
encoding, lines = detect_encoding(buffer.readline)
File “/usr/lib/python3.4/tokenize.py”, line 416, in detect_encoding
encoding = find_cookie(first)
File “/usr/lib/python3.4/tokenize.py”, line 380, in find_cookie
raise SyntaxError(msg)
File “”, line None
SyntaxError: invalid or missing encoding declaration for ‘/usr/lib/python3.4/threading.py’
16-11-02 12:36:42 homeassistant.components.recorder: Ended unfinished session (id=19 from 2016-11-02 12:25:53.343709)
16-11-02 12:36:42 homeassistant.components.recorder: Found unfinished sessions

Here is my entry in configuration.yaml
device_tracker 2:

  • platform: icloud
    username: @.com
    password:

the username is a standard email address (letters only, other than the @)
the password is standard characters, as well

Are cookies stored elsewhere? Any pointers are appreciated. Thanks!

Same error here, how can it Be fixed ?

Also same issue. I don’t have 2FA set up.

and here is my error log:

17-02-21 08:35:41 INFO (MainThread) [homeassistant.bootstrap] Setting up zone
17-02-21 08:35:41 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=None, new_state=<state zone.home=zoning; longitude=-xxx, hidden=True, radius=100, icon=mdi:home, latitude=xxx, friendly_name=My Home @ 2017-02-21T08:35:41.380036-05:00>, entity_id=zone.home>
17-02-21 08:35:41 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=zone>
17-02-21 08:35:41 INFO (MainThread) [homeassistant.loader] Loaded device_tracker.icloud from homeassistant.components.device_tracker.icloud
17-02-21 08:35:41 INFO (MainThread) [homeassistant.bootstrap] Setting up device_tracker
17-02-21 08:35:41 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.icloud
17-02-21 08:18:07 INFO (Thread-7) [pyicloud.base] Authenticating as [email protected]
17-02-21 08:18:09 INFO (Thread-7) [pyicloud.base] Authentication completed successfully
17-02-21 08:18:09 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform icloud
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 345, in _make_request
    self._validate_conn(conn)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 844, in _validate_conn
    conn.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/util/ssl_.py", line 324, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 377, in wrap_socket
    _context=self)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 752, in __init__
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 988, in do_handshake
    self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 633, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 54] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 649, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/util/retry.py", line 347, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 345, in _make_request
    self._validate_conn(conn)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 844, in _validate_conn
    conn.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/util/ssl_.py", line 324, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 377, in wrap_socket
    _context=self)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 752, in __init__
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 988, in do_handshake
    self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 633, in do_handshake
    self._sslobj.do_handshake()
requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/homeassistant/components/device_tracker/__init__.py", line 165, in async_setup_platform
    disc_info)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/futures.py", line 361, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
    future.result()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/homeassistant/components/device_tracker/icloud.py", line 80, in setup_scanner
    icloudaccount = Icloud(hass, username, password, account, see)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/homeassistant/components/device_tracker/icloud.py", line 156, in __init__
    self.reset_account_icloud()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/homeassistant/components/device_tracker/icloud.py", line 188, in reset_account_icloud
    for device in self.api.devices:
  File "/Users/ob1/.homeassistant/deps/pyicloud/base.py", line 270, in devices
    self.params
  File "/Users/ob1/.homeassistant/deps/pyicloud/services/findmyiphone.py", line 28, in __init__
    self.refresh_client()
  File "/Users/ob1/.homeassistant/deps/pyicloud/services/findmyiphone.py", line 44, in refresh_client
    'selectedDevice': 'all',
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/sessions.py", line 535, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/Users/ob1/.homeassistant/deps/pyicloud/base.py", line 67, in request
    response = super(PyiCloudSession, self).request(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/adapters.py", line 473, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))