Unifi Controller - Block Switches

Hi guys.

Im trying to implement the Unifi Controller with switches to enable and disable the kids tablets.

Ive updated to latest Home assistant.

added the integration thru the webinterface. And the added the following to configuration.yaml

unifi:
  controllers:
    - host: xxx.xxx.xxx.xxx
      site: Degnevangen 20
      block_client:
        - 'xx:xx:xx:xx:xx:xx'

But the switches does not show in my states ui.

Anyone have a good idea ?

I had same problem
Double check the mac id from the tablets for capital and lowercase letters

Make sure that the user has admin rights

Should they be in capitals or lowercase?

It depends :
you have to look at the Mac id on the device itself and not the Mac id that you can see like from an ip scanner.
At first I copied also the Mac id from a device ip scanner and that was different (= capitals & lowercase) than the one on the device itself

I’m having the same issue. Verified that the site was correct, that the account used for the integration has admin permissions in Unifi controller. Double checked the mac addesses, tried upper and lower case. I can’t figure out why the block switches aren’t showing up for any of them. Also, not seeing anything in the logs indicating that there is an issue with Unifi.

I am reworking the data fetching of UniFi integration right now and will revisit block switches after that. I will try to add frontend support for it so we don’t need to evaluate if the configuration is properly defined in configuration.yaml

2 Likes

Sounds great! Thanks for the update!

Anyone else having issues with block switches after the 106.2 update? my switch no longer turns off - it just toggles back on again after i turn it off. At times it does disable the internet but it’s harder to tell now if the deivce is blocked on the internet or now :frowning: maybe it’s something i have missed in the breaking changes.

I have the exact same problem. Did you get it solved?

I’m working on solving it. Apologies for the inconvenience

Thanks @Robban it’s starting WWIII at my place since the wife is getting confussed with the toggle :slight_smile:

Got block working, doing a small fix for it https://github.com/home-assistant/core/pull/32625

Before the fix my switches toggled back on when blocking. After the fix they toggle back off when unblocking…
The device tracker status switches back to home but since the switch toggles back to off I cannot block the device again

The fix is on the 0.107 beta. Have you tried it?

Hi @Robban, thanks for this,

  • if the internet is ON and i turn it OFF - then it toggles back ON then it’ll go back OFF after a second or so.
  • if the internet is OFF and i turn it ON - then it toggles back OFF then it’ll go back ON after a second or so.

Hope this makes sense, I’m on 0.107.0b3

What version of the controller are you running?

Controller Version 5.12.66

Weird, ut works perfectly fine with 5.12.35

it is working for me it’s only that switching is a little different - but it does definatly block the connection which is good - thanks for resolving that.