Ubiquiti unifi component doesn't work

hi all, i tried to add the ubiquiti unifi component for device tracking, but strange things happend.
it doesn’t creat the known_devices.yaml and in the home assistant log it says:
2017-08-17 20:07:57 ERROR (MainThread) [homeassistant.components.device_tracker] Unable to load /home/homeassistant/.homeassistant/known_devices.yaml: Config file not found: /home/homeassistant/.homeassistant/known_devices.yaml
2017-08-17 20:08:04 ERROR (Thread-5) [homeassistant.components.device_tracker.unifi] Failed to connect to Unifi: Login failed - status code: 400
2017-08-17 20:08:04 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform unifi
i tried to creat the yaml file by myself, but it doesn’t works. The username and the password are correct and also the ip address of the controller that is installed on a windows pc and not in the rasp.
here’s my config

> device_tracker:
>   - platform: unifi
>     username: xxxxxxxxxx
>     password: xxxxxxxxx
>     host: xxx.xxx.x.xxx
>     interval_seconds: 10
>     verify_ssl: false   

any ideas?
thanks

Please wrap configuration blocks with the </> button, as explained in the big blue box at the top.

That suggests an error with the username or password (or both).

i copy paste the user and pass in the unifi login page and they works fine.

EDIT: find the problem. i have a special caracter in the psw. i create a user only fo HA with a different password and it works. thanks

another issue. i can track my device, but the sensor always stay on “home” state.
when i disconnect my phone from the wifi the state pass for a secondo to “away” but it return immediately to “home” state.
any ideas?

Are you only using the Unifi device tracker?

Maybe try specifying the port as well? Here’s what my config block for UniFi looks like:

device_tracker:
  - platform: unifi
    host: 192.168.x.xx
    port: 8483
    username: username
    password: !secret ap_password
    verify_ssl: False

Also, not sure if the yaml file is case-sensitive but I have “False” for verify_ssl, not “false.”

yes, i set the “interval level” to 60 and now it work’s fine. but i’m experimenting a significant delay between the home to away when i disconnect my device, more then 60 seconds. is there a way to get the unifi controller refresh faster?

If you set it too short, then you’ll have many false positives where it thinks you’ve left when you haven’t.

try setting “consider_home”

i set the “consider_home” to 60 sec and it works fine, but when i disconnect my device it takes a longer time to change the state to “away”.
i think the problem is the refreshing time of the controller that is too hight, so when i disconnect my device it takes some minutes to go away from the unifi controller.

That’s normal, going away always takes a little longer. In part because you don’t want a single missed response to mark a device as away, when it simply didn’t respond for some reason. If you need a faster response then it’ll need to be done with something you trigger manually.

Hey,

I’m also having issues with my Unifi setup but the situation is a bit different. I’ve posted about this in another thread, since you seem to know a thing or two about Unifi would you mind taking a look? It would be very helpful, I’ve tried many things and I’m not sure what’s going wrong. Thanks in advance!

thanks for the support.

Hi, similar/related issue, I can login to the unify controller directly, but when I use this userid & password through Home Assistant it’s not working. Can not login using hass.io > Configurator > Unify Controller > Open WebUI either.

Hope that someone can shine a light… thanks!

Config file:

Unify

device_tracker:

  • platform: unifi
    host: 10.0.x.x
    port: 8443
    username: !secret username
    password: !secret password_2
    site_id: default
    track_new_devices: false
    interval_seconds: 120
    consider_home: 300
  • platform: unifi
    host: 10.0.x.x
    port: 8443
    username: !secret username
    password: !secret password_2
    site_id: default
    track_new_devices: false
    interval_seconds: 120
    consider_home: 300
  • platform: unifi
    host: 10.0.x.x
    port: 8443
    username: !secret username
    password: !secret password_2
    site_id: default
    track_new_devices: false
    interval_seconds: 120
    consider_home: 300

Hmm mine is working here is my setup

Don’t write 3 platforms named unifi…

## Unifi
  - platform: unifi
    host: 192.168.X.X
    port: 8443
    username: !secret unifi_username
    password: !secret unifi_password
    ssid_filter:
#     - 'wlan1'
#     - 'guest'
    verify_ssl: False
    site_id: !secret unifi_siteid
# 30    
    interval_seconds: 30
    consider_home: 1200
#   detection_time: 300
    new_device_defaults:
      track_new_devices: True
      hide_if_away: False

I had to remove some things like ssid_filter.

Are you sure your unifi_siteid is default?
Check the http string to your management unifi site and see what it says?
https://192.168.X.X:8443/manage/site/unifi_site_id /dashboard

please try to paste your code correctly :slight_smile:

1 Like

Have any of you figured out why the unifi device_tracker component does not work?

Sorry for hijacking the thread,

I’m going to use my Ubiquiti WLAN AP as a device tracker. But I was wondering how this module works. Main consern is that my Ubiquiti WAP and HA are in different VLANs. WAP is in 192.168.20.0/24 and HA is in 192.168.10.0/24 so the Ubiquiti login page is not available from the subnet/VLAN HA is in.

HA is in the network that is coming from WAP so it is connecting to WAP SSID.

But I am guessing that this is going to be a problem? Ubiquiti device tracker is needing direct access to WAP login? So I should open the VLANs so that HA host would be able to access the login page?

Just wanting to confirm this with you guys before making any changes since it is going to be a bit a hassle.