Presence detection with unifi

Thanks, when you added this, did it create known devices file automatically and filled it with the name of your devices?

you’re right, but devices will not be added to HA

I have upgraded HA to 0.95.4. Now my Unifi presence detection stopped working.

Nothing is logged in the logs even after adding the unifi component logging.

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

This is the only log entry i could see in the log.

INFO (SyncWorker_19) [homeassistant.loader] Loaded unifi from homeassistant.components.unifi

  - platform: unifi
    host: domain.duckdns.org
    port: 443
    username: user
    password: password
    interval_seconds: 10
    consider_home: 180
    track_new_devices: true
    hide_if_away: false

I am using a read only user account for unifi.

Am I missing something, Is there any known issue?

1 Like

UPDATE

Looks lime we have to use the “Integrations” page to configure the Unifi Controller first with a admin account. So that it will add the controller as below in integration page.

image

After adding the integration it started working!

I have 3 ssids and only want to track devices (clients) on one of the ssids. I set up the integration and then added the config lines as explained here, but all of my clients are still showing up in HA. Anyone know what I am doing wrong, or is this broken? I just updated to hassio v 0.99.2.

unifi:
  controllers:
    - host: 10.1.11.200
      site: Default
      detection_time: 180
      dont_track_wired_clients: true
      ssid_filter:
        - 'MH_Main'

Is it possible to do this with an existing Unifi Controller? I have one running in docker, and hooked up to traefik. I’d like to keep it this way.

EDIT:
Sorry found it already, under intergrations

Did you ever work this out?

No. I’m still pulling presence from all the ssids :frowning:

I found that you can disable new entities being added automatically in the integration. See the release notes here see if they help.

Look under the entity management section. My understand is with this enabled the items will be discovered BUT they will not be enabled by default and so you can then go into the entity register and enable them there.

1 Like

I’m working on improving how to configure ssid filter. It should be fixed for next major release within the next release or so, right now I depend on GUI support for multi select to get this working.

1 Like

I am also currently struggling with the integration of the UniFi presence detection.
I did setup the integration and added the following to my config:

device_tracker:
  - platform: unifi
    host: 192.168.1.9
    username: <my_user>
    password: <my_password>
    verify_ssl: false
    detection_time: 10
    new_device_defaults:
      track_new_devices: false

Still… when I now restart HA, I get the following warning:

The following integrations and platforms could not be set up:

* [device_tracker](https://www.home-assistant.io/integrations/device_tracker)

Please check your config.

and in the logs:

2020-04-02 17:33:45 ERROR (MainThread) [homeassistant.setup] Error during setup of component device_tracker
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 170, in _async_setup_component
    hass, processed_config
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/__init__.py", line 129, in async_setup
    legacy_platforms = await setup.async_extract_config(hass, config)
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py", line 112, in async_extract_config
    f"Unable to determine type for {platform.name}: {platform.type}"
ValueError: Unable to determine type for unifi: None

I tried with my unifi admin-user and also with my unifi read_only user. No change…
UniFi is running at 5.12.66 and HA on 0.107.7

Would be glad for your help :slight_smile:
Cheers,
Georg

You should configure it through integrations pane in frontend. The way you configure it is not supported. I think it is documented how to configure it in the integration documentation.

1 Like

Very cool! Thank you!
I didn’t see the little gear icon up there before. Thank you very much…

1 Like

As nowadays the presence configuration is done vie Integrations tab: is there any chance to change the username/pw that was used to set up the Unifi Controller in Integration tab? Or would I have to delete an readd it?

I mean, where is it stored? I went though all configuration files and did not find anything related.

.storage/core.config_entry

However, those files aren’t meant to be edited…

It’s probably best (safety wise) to remove and re-add the integration.

I will add support for the frontend to update username and password

3 Likes

@Robban

Whatever happened about adding the option to remove the “wired/wireless bug” workaround (or what ever it was called)?

I haven’t seen it added unless I missed it somewhere.

Didn’t you get a notification on the issue?

I have a pull request up for review https://github.com/home-assistant/core/pull/34067

No, sorry. no notification that i remember. Heck a lot of times I don’t even get notifications on the issues filed for my own github repos for a couple of lovelace things I’ve contributed.

Thanks for working on it and for the info. much appreciated.

1 Like