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

I have i running on a separated pi Zero W. that way you never have problems updating the two. the total investment was below €20

Thx, I’ve found an old RasPi 2B and installed the controller there. But to be honest I’m still interested in getting it to work on one RasPi just to get to know the way Hassio/Resinos works a little better.

And since you’ve got this setup working, maybe you can help me with another problem? I do have the controller running on my 2B but it can’t find the Unifi device in my network although it’s connecting over wifi through that actual AP. The Raspi gets an IP address from my router on the same subnet as the AP. When I use the controller from my Mac everything just works fine but the controller on the Raspi can’t find the AP. Any clue what I might be doing wrong? Thx a lot!

i got the same problem. i backup my controller from the pc and load teh backup file in the RPI Controller. then wait a long time. and it was up and running.

Awesome, that sounds hackish enough so that it just might work :wink: I’ll give it a try!

I have created a Hass.io add-on running the UniFi controller. If I can find the time I will setup a repository so you can test it.

That was’nt too hard. :slight_smile:
You can install and test it by adding this repository: https://github.com/stefanlaheij/hassio-addons

2 Likes

Thanks for the add-on!

However, when I click on the Install button it start to install the add on (the loader gif appears). After some time (approx. 5 minutes) the install button appears again, but the add-on is not installed.

What platform are you running Hassio on? I have only tested this on a Raspberry Pi 2.

I´m also running on a Raspberry Pi 2. I installed the Hassio image for Rpi 2, is that why it does not work?

That’s strange. I used the SD-card image last week from https://home-assistant.io/hassio/installation/

Can you check Hassio>3-dot menu (top right)>Advanced Settings>View Logs?

This is what the log is saying:

17-10-19 19:28:02 INFO (SyncWorker_9) [hassio.dock.addon] Start build ceecc69e/armhf-addon-unifi:0.94
17-10-19 19:31:22 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/aiohttp/web_protocol.py”, line 422, in start
resp = yield from self._request_handler(request)
File “/usr/lib/python3.6/site-packages/aiohttp/web.py”, line 306, in _handle
resp = yield from handler(request)
File “/usr/lib/python3.6/site-packages/hassio/api/util.py”, line 31, in wrap_api
answer = await method(api, *args, **kwargs)
File “/usr/lib/python3.6/site-packages/hassio/addons/addon.py”, line 463, in install
if not await self.docker.install(self.last_version):
File “/usr/lib/python3.6/site-packages/hassio/dock/util.py”, line 18, in wrap_api
return await method(api, *args, **kwargs)
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/hassio/dock/addon.py”, line 198, in _install
return self._build(tag)
File “/usr/lib/python3.6/site-packages/hassio/dock/addon.py”, line 211, in _build
image = self.docker.images.build(*build_env.get_docker_args(tag))
File “/usr/lib/python3.6/site-packages/docker/models/images.py”, line 175, in build
raise BuildError(chunk[‘error’])
docker.errors.BuildError: The command '/bin/sh -c apt-get update && apt-get install -y --no-install-recommends oracle-java8-installer=${JAVA_INSTALLER_VERSION} oracle-java8-set-default && rm -rf /var/lib/apt/lists/
&& rm -rf /var/cache/oracle-jdk8-installer’ returned a non-zero code: 100

Maybe the package repository has some issues.
I will have a look if I find the time.

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!