Unifi Switches POE control

I am trying to controll network access with the unifi integration. I it worked before but now it doesnt make a switch for each device i add?

Atleast i cant find any switches.

image

They are disabled by default, you have to enable them

Ahh found it. But this only removes POE on a port, the integration can not block he whole port from the network?

No they just switch the POE power as far as I can tell

This thread is about PoE not network access.

Network access has a limitation right now that you need to restart home assistant or the integration after changing the clients you want to block.

Just saw this post. I’ve got some feedback, hehe.
Very happy this seems to work!

When triggering switches it doesn’t behave consistently.

See my full post here: Unifi integration - PoE switches inconsistent behaviour: How to solve this automation?

This issue has existed for a long time. Once I am done with refactoring the integration i will improve functionality like this.

2 Likes

Thanks so much Robban!

Thank you for the great work.
After configuration, I now see some new switches for POE clients.

However, I don’t see Unifi APs or other Unifi POE powered switch in the list. I though this new feature would support controlling all ports. Am I missing something ?

Cheers

The new poe ports are exposed as disabled entities. You will have to map what port number a access point or switch is powered from and then enable that entity

Ah yes, I found them. Thanks !
However, I enabled one entities (switch.none_port_4_poe) for one AP, but disabling it is not accepted and it return to the enabled state after one second or so.

I tried multiple times and let it alone for a some time, but the entity state never change.

Ok, if you enable debug logging for the unifi integration do you see a specific message when performing the command?

just came to say @Robban that the switch control is fantastic…this very much for making it.

1 Like

Thank you very much :pray:t2:

I also want to give a big thank you @Robban… love this integration. Really great work.

1 Like

Thanks! There is still a lot to do with it though :sweat_smile:

I absolutely love the ability to turn on or off PoE. As stated it’s not flawless yet. I’m patient and don’t want to rush the people working on it. So in the meantime I wanted to create a backup script if one of my commands fails.

alias: script.check_switch_status_off
sequence:
  - if:
      condition: state
      entity_id: switch.tech_azi_1_living_room_poe
      state: "on"
    then:
      - service: switch.turn_off
        target:
          entity_id: switch.tech_azi_1_living_room_poe
  - if:
      - condition: state
        entity_id: switch.tech_azi_2_playcorner_poe
        state: "on"
    then:
      - service: switch.turn_off
        target:
          entity_id: switch.tech_azi_2_playcorner_poe
  - if:
      - condition: state
        entity_id: switch.tech_azi_3_attic_2_poe
        state: "on"
    then:
      - service: switch.turn_off
        target:
          entity_id: switch.tech_azi_3_attic_2_poe
  - if:
      - condition: state
        entity_id: switch.tech_garden_poe
        state: "on"
    then:
      - service: switch.turn_off
        target:
          entity_id: switch.tech_garden_poe
mode: single
icon: mdi:wifi-remove

Am I correct when assuming that the sequence will run from top to bottom, even if for example switch.tech_azi_2_playcorner_poe is indeed off as it should be?

Hello to all,

First of all a huge THANK YOU to @Robban - Here is really a lot of work and it is constantly evolving.

I’ve read over all the comments here and apparently PoE port on/off now works for all devices? (also Unifi APs?)

I’m getting my Unifi USW-48-PoE tomorrow and connecting several U6-Pro APs there.
What exactly do I need to be able to turn the APs on/off via Home Assistant?
The description of the “UniFi Network” integration still says that PoE Control is not supported for Unifi devices.

Would be very grateful if someone could bring me up to date again and tell me how best to implement it.

Thanks in advance!

1 Like

Thank you for those kind words!

The documentation (as is the norm) is lacking :smiley: , yes the PoE control is per port now rather than the device connected to the port, simplifying the overall design and providing control to all ports.

What you need to do is to enable the entities for those PoE ports you want to control. They are disabled by default.

There are two current limits;

  1. changing state on multiple ports too quickly resets the previous commands, I plan on doing some kind of fix of this in the future, but it currently requires you to plan changing the state of multiple ports a bit
  2. IIRC you can not control those older PoE devices which uses the proprietary PoE format, I also plan on fixing that some way.

(No time plan for any of these improvements though)

Cheers! /Robban

1 Like

Thanks so much for your response - Sounds great!

I would like to turn off three PoE ports on the Unifi switch every night 00:00 to 06:00 so that the AccessPoints do not run unnecessarily during the night.
Are three ports already a problem with normal automation or do I need to trick a little?
How much time should there be between each port change? Then I may have to work with a delay?