Unifi Switches POE control

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?

No the only thing you currently would need to do is switch the ports one by one and waiting some time between the ports. You can find an automation example here components/unifi/switch.py 401 error when mutiple switches are toggled Ā· Issue #83021 Ā· home-assistant/core Ā· GitHub

Really great - Super integration!

Would you even turn off the APs overnight?
Or just turn off the SSIDs with the scheduler? Or none of that at all?

I have 3 APs which are all wired - so I have mesh disabled. Wifi device auto link is also turned off.

First and foremost, Iā€™m thinking about radiation at night - got two small children at home.
Besides, it would save a little power with 3 APs, which are switched off 6 hours each night.

Only Iā€™m unsure whether the APs like that in the long run at all, if you make them abruptly currentless every day.

What do you think?

Thatā€™s all up to you and what you have in your home depending on wifi I guess. A very individual question. Iā€™m not sure itā€™s too common turning off wifi at night

Do you think it could harm the APs if they are abruptly switched off and unpowered every day? (PoE Port toggle)

Is it possible to turn off/on the SSIDs via Home Assistant integration?

(Please excuse all the questions - most of my network equipment is new and I want to control everything in the best possible way)