Home Assistant Community Add-on: UniFi Controller

That’s what I was hoping. Thanks

Yes this is possible, i’m using the default NGINX Home Assistant SSL proxy add-on.
Within the configuratio you need to set

customize:
  active: true
  default: nginx_proxy_default*.conf
  servers: nginx_proxy/*.conf

Then you need to create an folder ‘nginx_proxy’ in de share folder with the samba share addon
in this folder you put a file unifi.conf or something with the following configuration

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name unifi.somedomain.com;
    ssl_certificate /ssl/fullchain.pem;
    ssl_certificate_key /ssl/privkey.pem;
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

    error_page   403  /403.html;
    location = /403.html {
         root   /share/nginx_proxy;
    }
    
    location / {
      allow 192.168.1.0/24; # Allow local
      deny all; # Deny everyone else

      proxy_pass              https://ip_unifi:8443;
      proxy_set_header        X-SSL 'on';
      proxy_set_header	      Host $http_host;    
      proxy_set_header	      X-Forwarded-Host $http_host;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        X-Forwarded-Proto $scheme;
	  
      # Fix the “It appears that your reverse proxy set up is broken" error.
      
      proxy_read_timeout  90;
      proxy_buffers 16 16k;
      proxy_buffer_size 16k;
    }
	
    location /wss/ {
      allow 192.168.1.0/24; # Allow local
      deny all; # Deny everyone else
	  
      proxy_pass https://ip_unifi:8443;
      proxy_http_version 1.1;
      proxy_buffering off;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "Upgrade";
      proxy_read_timeout 86400;
      proxy_set_header Host $http_host;
    }
} 

I have put in a 403.html in the same share\nginx_proxy folder for a custom 403 page because i set a allow list on the page that it is only accessable within your own network. The 403.html custom page is that the default page is not used where the nginx verion is visable in. Somewhat safer i think.
But You can remove the custom 403 and the allow and deny rules if you want it acessible from the internet.

1 Like

I’m having trouble opening the WEB UI. The addons starts and the log looks ok, no errors what so ever. When opening the WEB UI I see

This site is not reachable
Connection rejected
ERR_CONNECTION_REFUSED

I’ve tried changing some ports in the settings, but that doesn’t help.

Anyone? @frenck ?

I think you need to provide a bit more information.
I have had this in the past and unfortunately was caused by a corrupt DB, but before you uninstall and reinstall the addon, you might want to check some of the following to ensure it really is not related to the network config:

  1. did you check the port being used. Are you able to call the web UI by it´s IP address and port from within the LAN? e.g. https://192.168.x.x:8443 (or HTTP)
  2. If from outside of the LAN did you open the port on your router and add a NAT rule to redirect the traffic correctly?

Hi Piggy

Thanks; when I go to just the IP address I get to see - both on HTTP and HTTPS:

Bad Request
This combination of host and port requires TLS.

I’m not really into this (technical) stuff, so sorry if this all is kinda stupid :expressionless:

— EDIT —
I must have done something wrong, because I get to see it now just entering the IP address :slight_smile: Is that ok? Or?

I get the same message when I use http://192.168.x.x:8443/, but it works when I use https://192.168.1.52:8443/ as the system is expecting a secure.
If it works for you now and you can log in, you are fine!

I was a little to late with my edit =) on HTTPS it works and I get to see the wizzard. Is it just fine to walk trough it or is it a problem that Home Assistant doesn’t see it / doesn’t opens the WEB UI correct?

I take it as fine (I have it like that at least) as you likely just like me have DuckDNS with Letsencrypt, so secure, but when going to this port, it is not part of the domain you have the certificate for and thus not working as smooth.

Perfect, will try it from here then

One more - hopefully last - question: the host to inform, is that the internal IP address in this case, or the DuckDNS URL?

normally within your LAN its your IP address unless you have forwarded the port in your router. In that case you can use the DuckDNS URL, but it will still give a connection is not private as the port is different

1 Like

Hero of the day! Works! Thanks!

1 Like

Does anyone know where previous logs are kept (from previous runs) for the UniFi Controller Addon (1.1.4) please? Mine restarts when I run daily Google Backups which means I have to readopt access points and I wondered if there was a log entry that could help.
Host Operating System|: Home Assistant OS 7.1
|Update Channel|beta|
|Supervisor Version|supervisor-2021.12.2|
|Docker Version|20.10.9|
|Disk Total|109.3 GB|
|Disk Used|24.4 GB|
|Healthy|true|
|Supported|true|
|Board|rpi4-64|

Hello,
I installed the add-on and want to follow the following instructions:

The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on.

  1. Search for the “UniFi Controller” add-on in the add-on and install it.
  2. Start the “UniFi Controller” add-on.
  3. Check the logs of the “UniFi Controller” to see if everything went well.
  4. Click the “OPEN WEB UI” button, and follow the initial wizard.
  5. After completing the wizard, log in with the credentials just created.
  6. Go to the settings (gears icon in the bottom left) → Controller (tab).
  7. Change the Controller Hostname/IP to match the IP or hostname of
  8. the device running Home Assistant.
  9. Check the box Override inform host with controller hostname/IP.
  10. Hit the “Apply Changes” button to activate the settings.
  11. Ready to go!

But I think the settings page has changed. When I go to settings there is no “Controller (tab)” to click on, but I found something similar. When I go to System and then to “Application Configuration” I have the following:

I guess these are the settings to adjust in steps 7 & 8? So check “Override Inform Host” and fill in the IP address of Home Assistant at “Host for Inform”?

That is correct!

Hi Folks,
I have the Ubiquiti Unifi integration running in HA.
I have a Unifi Dream Machine Pro (UDM-Pro)
There is an uptime sensor option that I have checked.
image
Problem is that there is no option to adjust how often an event is trigger for teh uptime, and the recorder is logging uptime events for all devices about every second.

Is there any way to change the uptime event timings and if so, can it be done per device?
i.e. server device uptimes every 5 mins, access point uptimes, evey 30 mins, other devices every hour.

Changing this would significantly reduce the number of items in the recorder.

Thanks in advance.

1 Like

Don’t know about that, but you could also exclude the sensor from the recorder. Check the recorder docs for that

Thanks.
Actually, excluding is probably the best idea, it would still show the current uptime value, just not log it.
This would not catch any item that had been up and down multiple times, only the duration of the last uptime.
However, could probably easily log a down time event. i.e. when uptime reduces in value.

Cheers

Any chance for added support for ASUS Tinker Board S?

does anyone know if there is a way to ssh into this addon? Forgive me im pretty new to all this, i cant use the homeassistant.local or ip because another addon is using port 22 (terminal&ssh) and the ip that shows up in unfi web portal 172.30.33.4 doesnt work. I am attempting to create an auto backup and of settings using this but im only able to get into the actual usg. Thank in advance.