Error doing job: Task exception was never retrieved tplink

Setup device tracker with my tplink ac2300 router. It works some of the time and I get this message in the logs.

2018-03-08 17:15:34 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/urllib3/response.py”, line 543, in _update_chunk_length
self.chunk_left = int(line, 16)
ValueError: invalid literal for int() with base 16: b’’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/urllib3/response.py”, line 302, in _error_catcher
yield
File “/usr/lib/python3.6/site-packages/urllib3/response.py”, line 598, in read_chunked
self._update_chunk_length()
File “/usr/lib/python3.6/site-packages/urllib3/response.py”, line 547, in _update_chunk_length
raise httplib.IncompleteRead(line)
http.client.IncompleteRead: IncompleteRead(0 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/requests/models.py”, line 745, in generate
for chunk in self.raw.stream(chunk_size, decode_content=True):
File “/usr/lib/python3.6/site-packages/urllib3/response.py”, line 432, in stream
for line in self.read_chunked(amt, decode_content=decode_content):
File “/usr/lib/python3.6/site-packages/urllib3/response.py”, line 626, in read_chunked
self._original_response.close()
File “/usr/lib/python3.6/contextlib.py”, line 99, in exit
self.gen.throw(type, value, traceback)
File “/usr/lib/python3.6/site-packages/urllib3/response.py”, line 320, in _error_catcher
raise ProtocolError(‘Connection broken: %r’ % e, e)
urllib3.exceptions.ProtocolError: (‘Connection broken: IncompleteRead(0 bytes read)’, IncompleteRead(0 bytes read))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/asyncio/tasks.py”, line 182, in _step
result = coro.throw(exc)
File “/usr/lib/python3.6/site-packages/homeassistant/components/device_tracker/init.py”, line 711, in async_device_tracker_scan
found_devices = yield from scanner.async_scan_devices()
File “/usr/lib/python3.6/asyncio/futures.py”, line 332, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.6/asyncio/tasks.py”, line 250, in _wakeup
future.result()
File “/usr/lib/python3.6/asyncio/futures.py”, line 245, in result
raise self._exception
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/lib/python3.6/site-packages/homeassistant/components/device_tracker/tplink.py”, line 164, in scan_devices
self._log_out()
File “/usr/lib/python3.6/site-packages/homeassistant/components/device_tracker/tplink.py”, line 257, in _log_out
cookies={‘sysauth’: self.sysauth})
File “/usr/lib/python3.6/site-packages/requests/api.py”, line 112, in post
return request(‘post’, url, data=data, json=json, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/api.py”, line 58, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/sessions.py”, line 508, in request
resp = self.send(prep, **send_kwargs)
File “/usr/lib/python3.6/site-packages/requests/sessions.py”, line 658, in send
r.content
File “/usr/lib/python3.6/site-packages/requests/models.py”, line 823, in content
self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
File “/usr/lib/python3.6/site-packages/requests/models.py”, line 748, in generate
raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: (‘Connection broken: IncompleteRead(0 bytes read)’, IncompleteRead(0 bytes read))

I don’t know why, but this has started working.