Presence detection with unifi

Hi!
I have problem with Unifi presence detection constantly toggling my network gear home/away. Whole my logbook is flooded with it:

I have already tried to setup integration from beginning, modify consider_home time, restarted everything, updated Unifi to last availabe firmware. Nothing helped or changed that behaviour.

It is not happening all the time- for example, today the problem persisted from 0:45 to 1:58, then from 6:42 for couple of minutes.

My config:

  • custom site
  • Home assistant core 0.109.6@docker
  • Hardware cloud key

Any idea what may be the cause?

1 Like

There are improvements to unifi integration and it’s device tracker implementation in 0.110. Beta is out if you want to try it out

1 Like

So far I have to say that adding the ability to remove the “wired bug” fix has definitely improved things greatly.

I disabled it and I haven’t had any issues that i’ve seen with my devices showing away when connected to non-unifi stuff.

Thanks for that modification.

Hopefully the next phase will be even better.

1 Like

Thanks for info. For now I disabled most of my device trackers, so I’ll wait for 0.110 stable. Hope it’ll fix that behavior.

Thanks for the feedback, glad it improved your situation. Not withstanding possible bugs Im quite happy with the state of the code in 0.110. It has become rewritten in a much more maintainable way

Unfortunately after updating to 0.110.1 problem still exists. I’ve even tried to remove whole integration and add configure it again, but it’s the same- state of unifi devices if flickering between home/away every couple of seconds.

1 Like

Create a new issue on GitHub with detailed logs

Did you end up creating an issue on GitHub? I’m having the identical problem of my Unifi gear rapidly switching between home and away on 0.110.4.

I can’t manage to make it work, maybe a firewall or DPI issue?

Gateway : UDM PRO

Home Assistant OS on Raspberry PI 4 in IoT VLAN.

conf file :

device_tracker:

  • platform: unifi
    host: !secret IOT_IP
    username: !secret unifigateway_user
    password: !secret unifigateway_pwd
    verify_ssl: false
    detection_time: 10
    new_device_defaults:
    track_new_devices: false

logs :

Logger: homeassistant.setup
Source: components/device_tracker/legacy.py:279
First occurred: 21:47:32 (1 occurrences)
Last logged: 21:47:32

Error during setup of component device_tracker
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/setup.py”, line 213, in _async_setup_component
result = await task
File “/usr/src/homeassistant/homeassistant/components/device_tracker/init.py”, line 52, in async_setup
await async_setup_legacy_integration(hass, config)
File “/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py”, line 153, in async_setup_integration
legacy_platforms = await async_extract_config(hass, config)
File “/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py”, line 279, in async_extract_config
raise ValueError(
ValueError: Unable to determine type for unifi: None

using the main LAN IP :

Logger: homeassistant.setup
Source: components/device_tracker/legacy.py:279
First occurred: 22:01:41 (1 occurrences)
Last logged: 22:01:41

Error during setup of component device_tracker
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/setup.py”, line 213, in _async_setup_component
result = await task
File “/usr/src/homeassistant/homeassistant/components/device_tracker/init.py”, line 52, in async_setup
await async_setup_legacy_integration(hass, config)
File “/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py”, line 153, in async_setup_integration
legacy_platforms = await async_extract_config(hass, config)
File “/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py”, line 279, in async_extract_config
raise ValueError(
ValueError: Unable to determine type for unifi: None

You should set it up using integrations page in the gui. Yaml hasn’t been supported for a long time

1 Like

I have an issue with the integration, probably something to do with linux epoc time, when it’s enable I have wrong data, e.g :

MacBook Pro WiFi (2020) Uptime

2673 weeks ago

That has been fixed, will be out with next release

1 Like

thank you !

Can I use an EdgeRouter X SFP or an UAP-AC-Lite to menage Presence Detection?
If so, how can I acomplish that?

This all depends on home assistant communicating with the unifi controller and gateway. Additional hardware can be mixed

When I try to configure the Unifi component I always get an error…
Should I place the Router IP or the AP IP? None of them are working.

The integration communicates with the cloud controller software without that it’s probably not going to work. Why not try one of the edge router integrations instead?

Why can’t I find that Integration?..

It’s in HACS

Sorry, I was lookink at Integrations. Thank you for your help!!!