Presence detection with unifi not working

Ive done a new install using the Hass.io RPi3 B+ 64bit, I have Unifi all working and setup but can not get presence detection working. The log comes up with:

2018-12-14 15:07:26 ERROR (MainThread) [homeassistant.components.device_tracker] Unable to load /config/known_devices.yaml: Config file not found: /config/known_devices.yaml
2018-12-14 15:09:35 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform unifi
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/urllib3/connection.py”, line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File “/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py”, line 80, in create_connection
raise err
File “/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py”, line 70, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 343, in _make_request
self._validate_conn(conn)
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 839, in _validate_conn
conn.connect()
File “/usr/local/lib/python3.6/site-packages/urllib3/connection.py”, line 301, in connect
conn = self._new_conn()
File “/usr/local/lib/python3.6/site-packages/urllib3/connection.py”, line 168, in _new_conn
self, “Failed to establish a new connection: %s” % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7f9c8bd2b0>: Failed to establish a new connection: [Errno 110] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/requests/adapters.py”, line 449, in send
timeout=timeout
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File “/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py”, line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘http’, port=443): Max retries exceeded with url: //192.168.1.63:8443:8443/api/login (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x7f9c8bd2b0>: Failed to establish a new connection: [Errno 110] Operation timed out’,))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/init.py”, line 176, in async_setup_platform
platform.get_scanner, hass, {DOMAIN: p_config})
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/unifi.py”, line 78, in get_scanner
site_id=site_id, ssl_verify=verify_ssl)
File “/usr/local/lib/python3.6/site-packages/pyunifi/controller.py”, line 89, in init
self._login(version)
File “/usr/local/lib/python3.6/site-packages/pyunifi/controller.py”, line 148, in _login
r = self.session.post(login_url, params)
File “/usr/local/lib/python3.6/site-packages/requests/sessions.py”, line 581, in post
return self.request(‘POST’, url, data=data, json=json, **kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/sessions.py”, line 533, in request
resp = self.send(prep, **send_kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/sessions.py”, line 646, in send
r = adapter.send(request, **kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/adapters.py”, line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘http’, port=443): Max retries exceeded with url: //192.168.1.63:8443:8443/api/login (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x7f9c8bd2b0>: Failed to establish a new connection: [Errno 110] Operation timed out’,))
2018-12-14 15:09:35 ERROR (SyncWorker_0) [homeassistant.components.notify.ios] The notify.ios platform was loaded but no devices exist! Please check the documentation at https://home-assistant.io/ecosystem/ios/notifications/ for more information

Im not sure where to go from here, would appreciate some help please.

Can you share your config?

Do you have the Unifi controller running at all times if using the component below? also read the other notes on that page about users and conflicts.

If you don’t have the controller running you should use this option:

I am seeing a similar issue after upgrading to the most recent Hassio version. I am not home to add in log details but I was seeing something very similar and all of my previously tracked devices were now showing as away.

I was using the direct AP method.

Im using the Unifi WAP and the controller is running all the time on hassio

Configuration.yaml:

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: xxxx
  longitude: xxxx
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 3
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: UTC
  # Customization file
  customize: !include customize.yaml

# Show links to resources in log and frontend
# introduction:

# Enables the frontend
frontend:

# Enables configuration UI
config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
  # Optional, allows Home Assistant developers to focus on popular components.
  # include_used_components: true

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

# Enables a map showing the location of tracked devices
map:

# Track the sun
sun:

# Sensors
sensor:
  # Weather prediction
  - platform: yr

# Text to speech
tts:
  - platform: google

# Cloud
cloud:

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

panel_iframe:
    configurator:
        title: Configurator
        icon: mdi:wrench
        url: http://192.168.1.63:3218

device_tracker:
  - platform: unifi
    host: http://192.168.1.63:8443
    username: "xxxx"
    password: "xxxx"
    ssid_filter:
      - 'HomeSSID'
      - 'IoTSSID'

Drop the http and port on the host line.

The port if not the default 8443 should be specified on a separate port: line per the docs.

See below for working config.

https://github.com/SilvrrGIT/HomeAssistant/blob/master/device_tracker.yaml#L21

1 Like

Thank you silvrr, up and running now

Thank you!!!