Unifi SSID filtering not working

Anyone else having issues with Unifi SSID filtering? It does not seem to work and wired devices are also tracked. This is very inconvenient as I run the USG and I’m having the following expirience:

  1. my iPhone disconnects from the Wifi
  2. After a couple of minutes, the Unifi integration detects the phone is gone and my device tracker states away
  3. My iPhone becomes known as a wired device (from what I find this is a bug in the Unifi Software).
  4. Home assistant picks up the device and marks the device tracker again as home
  5. After 30 min, my phone is no longer known on the network and the device tracker becomes away again.

Home assistant version: 0.97.2

Unifi Integration is working
Added the following in my configuration.yaml file:

unifi:
  controllers:
    - host: !secret unifi_host
      site: !secret unifi_site
      detection_time: 00:01:00
      ssid_filter:
        - WifiName

Same problem here. All my devices in my network are now known as a device_tracker.

The site is the nice name not the id as with previous device tracker configuration, that is what you see in the UniFi gui.

You can select to not track wired clients if you don’t want to, you can also select to not track devices.

The site is the nice name not the id […]

That’s what I’m doing (ssid_filter), it doesn’t work; all networks including wired networks are still being tracked rather than the one SSID I want.

I’d be great if there was a whitelist option to prevent devices than come and go on my networks to NOT get added automatically via the integration. I shouldn’t have to weed out individually as things get discovered, especially when I only want the UNIFI integration to track two specific devices on one SSID.

You can select to not track wired clients if you don’t want to, you can also select to not track devices.

Tried this too; it doesn’t work. Wired devices are still tracked and even devices I try to tell it to ignore (block_client), it still tracks.

This one is especially problematic as the new UNIFI integration is auto registering POE devices as switches. And when mixed with existing automations, groups, etc that include ALL switches; unintended actions are switching these devices off resulting in partial or catastrophic denial of service (turning cameras, DNS devices, RPI running HA itself, etc) depending on ones dependency on POE.

Additionally; the bug in the UNIFI software that occasionally reports a previously wireless device as a wired device; this triggers automations related to presence detection. Also problematic when the device isn’t actually home.

1 Like

I have a couple of activities on going which will remedy these issues (hopefully). It will just take some time to finish.

These kind of things are better to create GitHub issues over. Some already exist. Problems gets lost in the forum over time.

1 Like

Understood; I’ve seen the open (and some closed issues) over at github as well as the debate over the architectural change this seems to be rooted in (e.g. possibly over applied or the principle of the change isn’t specific enough). I’ve spoken up in a few items on github but in general my intent here was to add to the conversation as some people only look here; they should know they aren’t alone.

1 Like

I am trying to augment the behavior of the integration per the documentation, but things don’t seem to be working. core.config_entries lists host as 192.168.1.7 and I repeat this as the host in my config. For site, core.config_entries lists “default” and further down has “title”: “Actual Site Name”. In my config, do I enter “default” or “Actual Site Name”?

It is the nice name you should select. Now that config entry options are available I will migrate all configuration so this will not be a problem for long

I can confirm, in 103.5 SSID filter has no effect.

(A slightly off-topic start, but bear with me) I’m attempting to add filtering based on usergroup_id to the UniFi integration so that I’m only tracking a select few devices (not everthing on the WiFi). I added a bit of my own code (hard coded for testing) to the method below (which also does SSID filtering it would appear), and the filter isn’t working.

Code Snippet
@property
    def entity_registry_enabled_default(self):
        """Return if the entity should be enabled when first added to the entity registry."""
        if not self.controller.option_track_clients:
            return False

        usergroups = ["5e17f8eacff47e00f1ff54c6"]

        if (len(usergroups) > 0
            and self.client.usergroup_id not in usergroups
        ):
            return False

        if (
            not self.is_wired
            and self.controller.option_ssid_filter
            and self.client.essid not in self.controller.option_ssid_filter
        ):
            return False

        if not self.controller.option_track_wired_clients and self.is_wired:
            return False

        return True

I only have one SSID and no wired client, so I can’t test the other two filter options, but it looks like maybe filtering is just broken entirely. Any chance someone who’s more familiar with this integration might have a suggestion on what code might be at fault? I’m trying to wrap my head around it, but I’m still a bit new to HA.

I too cannot get the filter to work. The only way I can get Unifi data is through the Integration which doesn’t seem to respond to any of this extra config.

Whilst I would also like to ignore IOT SSIDs I have a slightly different primary use case, in that I have 3 APs in different physical locations with different SSIDs available on each. Each location also has a Home Assistant instance. I’d like to set each HA instance to be interested only in clients on its corresponding AP’s SSID for presence detection across the three locations. But the filter does not work; so any known client associated with any of the three APs shows up as “Home” and that’s all it can tell me - not also WHICH home.

I’ve also tried splitting one of the APs off into another “Site” in the Unifi controller, hoping that I could use the “Site” part of the config on each HA instance to filter them. But it sems the Integration only connects to the default site; I cannot get it to display clients from the second one.
This is the code that seems totally ineffective with the Integration:

# Example configuration.yaml entry
unifi:
  controllers:
    - host: unifi     # I am using the IP Of the server with the Controller app running on it.
      site: My site   # It doesn't seem to matter what I specify - I only get devices in the default site.
      ssid_filter:    # This doesn't seem to make any difference - I always see every device on every SSID.
        - 'HomeSSID'
        - 'IoTSSID'

It might be that this was never supposed to work with the Integration and was only applicable to some old method. Which would be a pity because I do very much want either a Site or SSID filter, and do NOT want to run three separate controllers to achieve that! Setting up and upgrading one on Windows is irritating enough as it’s a Java app in a wrapper shudder

So the configuration.yaml host and site configs are only used to identify which integration you run. If those don’t match what’s setup then it won’t attach the rest of you configuration.

This is really awkward and I aim to only support configuration through the frontend to simplify configuration of the integration.

Well I have also tried the host name of the server, and names of real sites, but it doesn’t seem to change its behavior.

When you say you aim to support configuration through the frontend, do you mean that there’s a different approach that I should be trying?

For ssid filtering not yet. Still some dependencies the frontend that needs to be implemented

Ah. I see.

If one clicks on a “Device Tracker” entity one can see a lot of information, including the SSID that the device is connected to. I wonder if I can make an Entity Filter Glance Card that will display entities where SSID = x, given that that information is in fact present on the entity…

You probably can :+1:

Hi, is implementing the SSID filter still on the cards? Currently far too many device trackers entities are being created. Also, wired entities are being created even though I’ve deselected them. The integration works well just creates a bit of a mess.

I added frontend support to configure ssid filter but. Try it out and feedback your experience

Hi Robban

Thanks for your quick reply. I am only using the front end configuration. Should I be adding additional configuration to configuration.yaml?

No that will be removed. Configuration.yaml is mirrors to the frontend settings