Connecting to unifi AC-AP Lite won't work

ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform unifi

Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connection.py”, line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File “/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/util/connection.py”, line 83, in create_connection
raise err
File “/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/util/connection.py”, line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py”, line 345, in _make_request
self._validate_conn(conn)
File “/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py”, line 844, in _validate_conn
conn.connect()
File “/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connection.py”, line 284, in connect
conn = self._new_conn()
File “/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connection.py”, line 150, in _new_conn
self, “Failed to establish a new connection: %s” % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x6cc76270>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/requests/adapters.py”, line 423, in send
timeout=timeout
File “/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py”, line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File “/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/util/retry.py”, line 376, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘192.168.2.252’, port=8443): Max retries exceeded with url: /api/login (Caused by NewConnectionError(’<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x6cc76270>: Failed to establish a new connection: [Errno 111] Connection refused’,))

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 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/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/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/lib/python3.4/site-packages/requests/sessions.py”, line 488, in request
resp = self.send(prep, **send_kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/requests/sessions.py”, line 609, in send
r = adapter.send(request, **kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/requests/adapters.py”, line 487, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘192.168.2.252’, port=8443): Max retries exceeded with url: /api/login (Caused by NewConnectionError(’<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x6cc76270>: Failed to establish a new connection: [Errno 111] Connection refused’,))

So I have HA 0.43; controller Unifi 5.4.1 and most recent version of AC-AP(as of april 2017). Checked all the settings, but still no luck. Is there a bug in my setup? Like in Python or connection from HA to Unifi?

Can you share the configuration you have for your device_tracker?

The logs seem to indicate that HA cannot reach your controller (assuming 192.168.2.252 is your UniFi controller and is running).
The host of device_tracker must point towards your UniFi controller and not the accesspoint itself. Could this be the case?

  - platform: unifi
host: 192.168.2.252
username: !secret unifi_username
password: !secret unifi_passw
verify_ssl: false

The controller is on my laptop which is not 24/7 on. That would be odd…

Is 192.168.2.252 the IP of your AP or your controller? Because it needs to be the latter.

Sorry, you were right! Now all devices appears.
So can you point me to the direction, where and how to install the controller software?

Can it be on a Pi like in Docker? Do you know how?

https://hub.docker.com/r/linuxserver/unifi/

docker pull linuxserver/unifi

Thank you!
Will work on it the coming days. First need to wait for the new Pi to arrive. And then I need to dive in the docker software.

Learned my lesson :wink:

So for others: not the IP address of the actual device should be in the config.yaml file but the IP address of where the CONTROLLER software runs.