Ubiquiti Unifi Controller: how to install on Hass.io image?

Hi,

I think the problem here is the apt commands that does not exist in the hassio build.

I can install your sprinkler add-on without any problem and I can see that you are not using any apt command in the docker file at all there. What do you think?

I now had the same issue with the java installer.
I created a new version that uses the built-in Java version. This should work. Please let me know!

I had the same java error message when trying to install on a PI 3 B. It is fixed now.

Thanks!

Thanks for making this add on - greatly appreciated as I want to stop using a power-sucking server to run my UniFi controller! I have things almost set up but am stuck on “Provisioning” (actually seems to be going back and forth between Adopting & Provisioning) when I’m logged into my rpi:8443 UniFi web management page. When I set this up through my original server, it adopts quickly with no fuss. Has anyone else seen this?

Hi, thx for this addon. I seems to work fine.

Can you tell me, where to put die config.json files? I need to make a change in the config.gateway.json file. But I cant find a folder on my hassio to put the config in. Thx a lot.

Hi kolossboss, the jsons are not configurable in this add-on.
If you have root access to your hassio maybe you can find the Docker folder?

Hi,
thx for reply. I tried to find the Docker folder. Its the official Resin Rapsberry hassio image. I dont know how to do this.

But no big deal. My needed configuration will be integrated into the Controller in Version 5.7.xx.

Great there is an Unify addon!

While installing I encouter the following error. Any idea why?

Log Details (ERROR)
Tue Dec 05 2017 10:28:00 GMT+0100 (West-Europa (standaardtijd))

Error setting up platform unifi
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/usr/lib/python3.6/site-packages/urllib3/util/connection.py", line 83, in create_connection
    raise err
  File "/usr/lib/python3.6/site-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 "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 346, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 850, in _validate_conn
    conn.connect()
  File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 284, in connect
    conn = self._new_conn()
  File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 150, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7402f570>: 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 "/usr/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='localhost', port=8443): Max retries exceeded with url: /api/login (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7402f570>: 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 "/usr/lib/python3.6/site-packages/homeassistant/components/device_tracker/__init__.py", line 149, in async_setup_platform
    platform.get_scanner, hass, {DOMAIN: p_config})
  File "/usr/lib/python3.6/asyncio/futures.py", line 331, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup
    future.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/device_tracker/unifi.py", line 60, in get_scanner
    site_id=site_id, ssl_verify=verify_ssl)
  File "/usr/lib/python3.6/site-packages/pyunifi/controller.py", line 89, in __init__
    self._login(version)
  File "/usr/lib/python3.6/site-packages/pyunifi/controller.py", line 148, in _login
    r = self.session.post(login_url, params)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 555, in post
    return self.request('POST', url, data=data, json=json, **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 618, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/adapters.py", line 508, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='localhost', port=8443): Max retries exceeded with url: /api/login (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7402f570>: Failed to establish a new connection: [Errno 111] Connection refused',))

Thanks!

Hi Sharki,

ever tried to set the option verify_ssl to False?

Best
Marc

Thanks a lot! That solved the problem.

Is it possible to verify the certificate, instead of just disregarding it?

A merry Christmas to anyone reading this :slight_smile:

You would have to install/trust the certificate in your OS or install a valid certificate.

I have the Unifi controller working fine on my hass.io install on a raspberry pi. I can login to it from any pc through [my_duckdns.org_name]:8443 and the AP is adopted and available in the controller. I have created a write protected admin user to use for hass.io. I have entered the following into my configuration.yaml:

device_tracker:
  - platform: unifi
    # host: !secret unifi_host
    username: !secret unifi_username
    password: !secret unifi_password

I get the following error:

2017-12-29 19:14:15 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform unifi
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 346, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 850, in _validate_conn
    conn.connect()
  File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/usr/lib/python3.6/site-packages/urllib3/util/ssl_.py", line 329, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
    _context=self, _session=session)
  File "/usr/lib/python3.6/ssl.py", line 814, in __init__
    self.do_handshake()
  File "/usr/lib/python3.6/ssl.py", line 1068, in do_handshake
    self._sslobj.do_handshake()
  File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)

Any ideas?

It worked after adding:

verify_ssl: false

to my config.

How do I upgrade the Unifi controller firmware in hass.io?
I have 5.6.26 (Version: atag_5.6.26_10236) and I can see that version 5.6.29 has been released. The only upgrades I find in the Unifi maintenance tab is for my AP’s.

@tomoqv did you find how to update the firmware?
Settings > Maintenance > Check Firmware Update does not seem to work for me, so a bit stuck.

No I didn’t. After some issues with my hass.io installation, I decided to put the Unifi controller on an Ubuntu server instead.

Thanks, I might end up doing the same. Shame as it would be nice and tidy on hass.io

Tried this?

I found that rebuilding the controller installs it with the latest version i.e. it is the only way I have found to upgrade the Unifi controller version.

This is great! Anyway we can select the beta version for install? I am currently running 5.9.4.