Integration of Unifi Controller

Hi,

being new to the HA community I have spent the last some days reading through dozens of posts on this issue, but have not found any solution so far - now I hope that I can get some help :wink:

I am obviously a rookie on HA and learn my way up.
Quick overview of my configuration;

  • I am using a hass.io installed on a Raspberry 3+

  • my network is based on a Unifi Security Gateway 3P, a Unifi Switch 16 POE and a UNIFI AP-AC-Pro - the USG is connected to a Draytek Vigor 130

  • the Unifi controller is only the SW Controller version, which I run through my iMac browser

  • there is a bunch of elements connected via ethernet to the switch and obviously quite a bit wireless connected.

I am now trying too integrate my unifi network to HA - no success so far and my self being a rookie, I am sure this is due to my mistake.

This is what I have done so far:

  • try to integrate via the HA interface Configuration->Integration->Unifi Controller - I entered the ip address with login details and nothing worked.

  • I have added also a device tracker to the configuration.yaml as follows:

device_tracker:
  - platform: unifi
    host: 192.168.1.35
    port: 8443
    username: !secret unifi_login
    password: !secret unifi_pw
    ssid_filter: 'NebuHome'
    verify_ssl: False
    monitored_conditions:
      - rx_bytes
      - signal
      - site_id
  • I have tried out both ways individually, i.e. using the HA interface without the device tracker in the configuration.yaml as well as with.

No success so far. I also had this without ssid_filter, which did not help.

The unifi controller itself runs great - but I cannot get it connected to HA and I am wondering why - any help, highly appreciated!

Thanks a lot!

Welcome to an endless pit of tinkering! :joy:

So when you’re saying you set up the integration from frontend and nothing works?

Are you sure the parameters are OK? It works to correct to the controller from a different computer?

It could be time to enable debug logs and see what gets printed

1 Like

Under 0.95.x of HA, you need to configure both the integration through the UI and also the component through the configuration files. For some reason, it fails to connect if you only have the configuration files and (for me at least) nothing shows up on the UI configured integration.

Both of them are required. Refer Unable to connect to UniFi controller 5.10.25 using HA 0.95.x

1 Like

Thanks, yes - I can access the controller from another and from the same computer , with the same parameters. Just not via HA :frowning:

How do I enable debug logs? I have in my configuration.yaml following entry:

logger:
  default: info
  logs:
    aiounifi: debug
    homeassistant.components.unifi: debug
    homeassistant.components.switch.unifi: debug

The home assistant.log file just shows:

2019-07-10 08:11:00 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi controller at 192.168.1.65
2019-07-10 08:11:00 ERROR (MainThread) [homeassistant.components.unifi.device_tracker] Failed to connect to Unifi:
2019-07-10 08:11:00 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform legacy

Is there another debug log-file to initiate?

Thanks!

From your config above:

1 Like

No, I copied by mistake the old log, which I have saved - sorry for the confusion! But that is not the reason, current log file:

2019-07-10 15:20:06 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi controller at 192.168.1.35
2019-07-10 15:20:06 ERROR (MainThread) [homeassistant.components.unifi.device_tracker] Failed to connect to Unifi:
2019-07-10 15:20:06 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform legacy

These are related to the device tracker configuration, what logs do you get from the config entry?

1 Like

I was reading through the thread - I understand it worked for you while having an entry in the configuration.yaml and then going via the interface, right?
Well, I have an entry as well as going through the interface, but the interface already denies any connection …

33

you might be referring to this?

2019-07-10 15:20:06 INFO (MainThread) [homeassistant.setup] Setting up unifi
2019-07-10 15:20:06 INFO (MainThread) [homeassistant.setup] Setup of domain unifi took 0.0 seconds.

I was happy when I saw that - however, I cannot access anything around unifi …

Is the user you are using for the Integration setup as Admin in the controller?
I remember reading some where that it didn’t need to be but then on another post that it did.
Also if your Unifi Site isn’t Default, you need to change that in the configuration.yaml.

There is an important question to ask: are you running the Unifi Controller 24/7?

If not, the is no actual Controller for you to connect to. The Controller is only accessible when running on your Mac.

You can make a test, installing the Controller within your Hassio installation (there is an add-on for it) and configuring it all again. Running as an add-on you’ll have 24/7 access to the Controller.

1 Like

That is a very good point and you are basically right - however, it should be able to connect while running on the iMac and during all my different tries, it was running on the iMac.

By the way, are you referring to this Unifi Controller add-on?

Yes, if you had the Controller running you should have been able to connect to it.

That’s the addon I was referring! I have used it for months without any problem but switched for a dedicated VM.

It is always about searching, reading. attempting, learning and eventually finding.

I am sure everybody is going to laugh now at me but I had a weird thought considering the IP Address of the Unifi Controller :wink: When I look into the controller settings of the Unifi Controller, it shows me a controller IP address which I have used in my endless attempts, however, I am not quite sure why that IP address appears there, because the IP address to be used is logically the IP address of the computer running the UNIFI controller and NOT the IP Address shown in the configuration settings of the controller.

Solving a problem, which is not a problem :wink:

1 Like

You need to change that IP to match your controller IP address. :wink:

When you say that, you mean I have to change that IP address to the ip address of the computer running the UNIFI Controller, right?

Yes. That IP is what is handed to an AP when it is added, to find the controller.

I am having issues getting HA to connect to Unifi. The log reports:

Log Details (ERROR)

Logger: homeassistant.components.unifi
Source: components/unifi/controller.py:434
Integration: Ubiquiti UniFi (documentation, issues)
First occurred: 6:15:42 PM (4 occurrences)
Last logged: 6:28:50 PM

Error connecting to the UniFi controller at 192.168.0.123.

My entry in my config.yaml is below. I have it logging in as a read only account and verified those creds work.
Any direction to read up on is greatly appreciated.
Just for clarity. This is running on the same Synology, but in a different container, not as an add-on.

##################
###Device Trackers
##################
device_tracker:
###Unifi
  - platform: unifi
    host: 192.168.0.123:8443
    username: !secret unifi_user
    password: !secret unifi_pw
    verify_ssl: false

jwb

Hello i have multiple sites @ my unifi configuration.
Is there any possibility to point which site integration should use?

You select site when you setup the integration