Trouble setting up unifi integration / component - Cloud Key Gen 2

How often to poll is interval_seconds:.

Number of seconds to determine the device being tracked as ‘home’ is consider_home:.

eg:

unifi:
  controllers:
    - host: unifi
      site: default
      interval_seconds: 10
      consider_home: 30

I dont think either of those address my issue.

Correct me if Im wrong, but Im trying to speed up how quickly I get marked as away after being home, which I believe detection_time covers per the docs:

“How long since the last seen time before the device is marked away, specified in seconds.”

The default is 5 minutes, which is exactly how long it takes before I show as not home currently. But when I change it to a shorter time, I dont notice a change currently.

I didn’t realize the Unifi components had its own configuration, and I didn’t notice you switched to that component (even after copying/pasting your configuration :roll_eyes:).

I’ve been using unifi configured under the device_tracker component with interval_seconds and consider_home without issue.

Updated as of .97, the device tracker is depricated I believe.

Oh I hadn’t noticed that. I may be in the same boat soon.

Are you sure you don’t need your Controller’s IP address as the host:?
IE:

unifi:
  controllers:
    - host: 192.168.1.7
      site: default
      detection_time: 120

derp maybe. lemme try that

That didnt do it either. The docs are confusing me though, as it says this:

“host” Same address as relevant config entry, needed to identify config entry"

What is it referring to when it says address of config entry?

I saw that and was confused too.

I thought maybe it meant ‘URL’ instead of ‘address’ but if that didn’t work for you then I’m at a loss too. :man_shrugging:

host address and site are required to identify unifi config entry in hass.

FWIW I use unifi2mqtt with my CK2 successfully. If you are happy using mosquitto then this should allow you full control over the integration with HA.

1 Like

Thanks. I have both of them and still see no effects from changing detection time.

unifi:
  controllers:
    - host: !secret unifi_ip
      site: default
      detection_time: 120

have you really named your site default? The configuration expects the site name, not the previously used site id

@Robban

Where do I find the name of the site? PErhaps Im confused

What is the DHCP Lease Time for the network you are using? My guess is that your network does not see your device as “absent” until a lease is not renewed (which IIRC takes place half way through the lease time set). So even if you reduce the scan to below 120 secs, the limiting factor might be whether the network has spotted you are not there. You should be able to test this by flipping your phone into airplane mode and watching the controller to see how long it takes for your device to fall off.

I use Monitor running on a few Pi Zeros (and triggered by a door opening) to spot absence, and use both Monitor and unifi2mqtt to spot presence. I find that most of the time my phone connecting to wifi is the quickest test for presence, but bluetooth absence is quickest for absence.

its what name you gave it in the unifi frontend

I dont remember an option to give it a name. Are you referring to this:

In the Unifi gui

@halpplz & @jparthum did you ever figure out what was needed for the integration? I’m having the same problem with getting the integration set up and don’t see anywhere in this thread what you came up with as a solution. When I put in the local ip address for my controller I keep getting the bad credentials response. I’m also using the Unifi Dream Machine and it has MFA enabled. Not sure how the integration will handle the MFA.

Thanks in advance for any help you can provide.

Some how after I added the logging config, it magically started working. My assumption is others have done the same and very few (if any) know why this gets the integration to work. Hence the reason the documentation hasn’t been updated and probably the reason the logging suggestion is included in the documentation.

Who knows. If I get more/solid info I’ll post here and maybe we can get the core documentation updated to reflect a clearer path to integrating the Unifi controller.

The logging information on the integration documentation is to support in debugging the integration and has nothing to do with work around any connectivity issues. None the less. It is not good if there are issues setting up the integration…