Unifi device track not working since 0.36

Anyone else having g issues with this component?
Connects at start then disconnect with error

17-02-08 16:26:08 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform unifi
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/device_tracker/__init__.py", line 158, in async_setup_platform
    None, platform.get_scanner, hass, {DOMAIN: p_config})
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/device_tracker/unifi.py", line 60, in get_scanner
    return UnifiScanner(ctrl)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/device_tracker/unifi.py", line 69, in __init__
    self._update()
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/device_tracker/unifi.py", line 79, in _update
    self._clients = {client['mac']: client for client in clients}
TypeError: 'NoneType' object is not iterable

I started on V0.33 and am now on V0.37 and the unifi tracker component is still working fine for me without having made a change at all.

I have created a separate user on the Unifi Controller for HASS, not sure why I did that, though, but I did this very early on.

what version unifi controller are you using?
This issue just started for me. I had lots of issues after upgrade to 0.36 so I thought this was related

My Unifi Controller is version 5.3.11 and runs on the same RPi3 as HASS - I upgraded it around Jan 20th from a previous version; donā€™t know which one that was, sorry :-S

Mine had stopped working I think after the upgrade to .37. My controller is 4.8.20, canā€™t remember why Iā€™m on the 4 track.

After reading this thread thought I would look into why, but noticed it had started working again. Havenā€™t rebooted the controller, which is a Ubuntu 16.04 VM. I have restarted HA loads of times since the upgrade and today is the first time Iā€™ve seen UniFi device tracking working.

Not much help to you unfortunately, I can try and look back through the logs if it will help but did definitely show an error previously on startup.

UniFi isnā€™t my primary device tracking so didnā€™t look too hard.

Unifi V5.4.9 with HA 0.36-0.37 versions
Unifi V5.4.11 with HA 0.37 version

I moved HA from Synology docker to RasPi around HA 0.35.3
I also upgraded Unifi around same period.

0.35.3 I had no issues but immediately had issues with several components after update to 0.36.
I thought it was HA but starting to believe install may be borked.

Iā€™ve been getting SQL and zwave errors since 0.36 as well.
I run unifi in docker so I may bring up older version and verify it not version issue

Looked a little more into this.
It seems to be working for about 15min, after that I get the error from original post
I guess its not getting back expected data (mac of connected clients)

Stranger is at the same time I get FFMPEG, SNMP component and even WEMO connection errors as well.
Starting to think this may be hardware issue (network bandwidth or memory)

On a side note, anyone interested in having unifi report zone?
I have several site (family houses on my controller) and thought itā€™d be nice if I could add each site and see location reported by unifi if I am at one of the sites.

Mine just stopped working due to an SSL error it seems. This does not seem to have affected earlier versions of HA (or at least I only just noticed with 0.40).

Unifi Controller is 5.4.11.

17-03-13 14:58:28 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform unifi
Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 345, in _make_request
    self._validate_conn(conn)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 844, in _validate_conn
    conn.connect()
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/util/ssl_.py", line 324, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.4/ssl.py", line 364, in wrap_socket
    _context=self)
  File "/usr/lib/python3.4/ssl.py", line 577, in __init__
    self.do_handshake()
  File "/usr/lib/python3.4/ssl.py", line 804, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 630, in urlopen
    raise SSLError(e)
requests.packages.urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/__init__.py", line 152, in async_setup_platform
    None, platform.get_scanner, hass, {DOMAIN: p_config})
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/unifi.py", line 53, in get_scanner
    site_id=site_id, ssl_verify=verify_ssl)
  File "/home/homeassistant/.homeassistant/deps/pyunifi/controller.py", line 65, in __init__
    self._login(version)
  File "/home/homeassistant/.homeassistant/deps/pyunifi/controller.py", line 123, in _login
    r = self.session.post(login_url, params)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/sessions.py", line 535, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

Any ideas?

My previous issue is possibly linked to something in my build. (Manual install). I ran in docker on same unit without issue. My controller shows HA logging in but something goes wrong after that.

The SSL error is a new issue.
They upgraded to pyunifi2.0 so probably some issue there(verified valid SSL cert)
I will test connection using my SSL certified domain(not local IP) and let you know if things change.

Just wanted to add that since upgrading my HA version, the Unifi Device Tracker is not working for me , and I am seeing the following errors in the log, which seem to suggest it might be SSL related.

Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 345, in _make_request
    self._validate_conn(conn)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 844, in _validate_conn
    conn.connect()
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/util/ssl_.py", line 324, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.4/ssl.py", line 364, in wrap_socket
    _context=self)
  File "/usr/lib/python3.4/ssl.py", line 577, in __init__
    self.do_handshake()
  File "/usr/lib/python3.4/ssl.py", line 804, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600) ```

Look at documentation again.
Config changed in 0.40 or so

Add

verify_ssl: false

HA look for valid SSL cert by default now
If I run in docker itā€™s OK.
It also works at restart but fails with subsequent updates.
It is something specific to my install (I will try to figure it out when it becomes important. Right now itā€™s no biggie)

1 Like

Thanks @tmjpugh - that extra lime looks to have fixed it (canā€™t believe I missed that)

Thanks @tmjpugh!

Solved my issues also!

Never figured out cause of error but today after upgrade to 44.1 it seems to be working again.

There was also change to Pyunifi in this release so not sure itā€™s related.