aiounifi icon indicating copy to clipboard operation
aiounifi copied to clipboard

Add support for Unifi Smart Power devices

Open starsoccer opened this issue 2 years ago • 8 comments

Creating ticket as requested here, https://github.com/home-assistant/core/issues/71531

Let me know what info you need. Happy to provide whatever is needed. Will just mention there are(as far as Im aware 2 different devices), Single Outlet: https://store.ui.com/collections/unifi-accessories/products/unifi-smart-power Strip: https://store.ui.com/collections/unifi-accessories/products/smartpower-strip

I have both of them(2 outlets, and 1 strip) so can provide whatever information is needed on either in case they different slightly

starsoccer avatar May 11 '22 19:05 starsoccer

Thank you, this is not nearly enough information to support them though. Could you perhaps share a diagnostics file from the UniFi integration as a start?

Kane610 avatar May 12 '22 18:05 Kane610

Sure, diagnostics file attached

config_entry-unifi-1eabc036c156a091a334f15b0fad5845.json.txt

starsoccer avatar May 12 '22 18:05 starsoccer

I have a SmartPower PDU Pro if that's helpful for testing etc.

robloh avatar Jun 29 '22 18:06 robloh

Right now I'm reworking the implementation do I try to avoid expanding it at the moment. It shouldn't take too long though I don't know if I'll have a pause during my summer vacation

Kane610 avatar Jun 29 '22 18:06 Kane610

Any update to this?

starsoccer avatar Sep 02 '22 15:09 starsoccer

Before expanding this Im doing some generic rewrites that will benefit future development. So no explicit ETA, maybe with 2022.10 but can't promise that

Kane610 avatar Sep 02 '22 15:09 Kane610

Thanks for your continued work on this @Kane610 . I also have the SmartPower PDU if you ever needed to test or obtain any information from this unit.

stephack avatar Oct 16 '22 21:10 stephack

After playing around with the Unifi API a little and doing some digging I came across this example of controlling the power outlets on a SmartPower PDU.

https://github.com/Art-of-WiFi/UniFi-API-client/blob/master/examples/modify_smartpower_pdu_outlet.php

Hopefully this helps as you continue to update the Unifi integrations.

stephack avatar Oct 17 '22 19:10 stephack

Good find. Thanks! Hope we can get it built into the UniFi integration at some point :) I'm looking to control the smart power strip.

rhdny avatar Dec 18 '22 14:12 rhdny

The Rewrite is going well, but I still won't promise an ETA though. This is on my todo list :)

Kane610 avatar Dec 19 '22 21:12 Kane610

Just wanted to note as of an update(not sure as to when) it does seem possible to control these devices(atleast the smart outlet and strip). They appear in home assistant now with toggles for the power.

starsoccer avatar Dec 22 '22 03:12 starsoccer

Just wanted to note as of an update(not sure as to when) it does seem possible to control these devices(atleast the smart outlet and strip). They appear in home assistant now with toggles for the power.

I just updated to 2022.12.8 but don't have any entities that allow me to control the outlets on the smartPDU yet. Good to see there is progress though.

stephack avatar Dec 22 '22 13:12 stephack

Another feature request https://community.home-assistant.io/t/support-for-usp-pdu-pro-in-the-ubiquity-integration/550746

Kane610 avatar Mar 22 '23 19:03 Kane610

Another feature request https://community.home-assistant.io/t/support-for-usp-pdu-pro-in-the-ubiquity-integration/550746

Can confirm for PDU I can not seem to control things. Single plug and strip still work fine for me

starsoccer avatar Apr 17 '23 15:04 starsoccer

Just bumping this. Would be great if PDU got added along with power consumption metrics

starsoccer avatar Jun 09 '23 13:06 starsoccer

I can perform any testing needed on the USP-PDU-Pro. Would love to see power consumption and relay switches in ha.

legomind avatar Jul 06 '23 13:07 legomind

@starsoccer

Just bumping this. Would be great if PDU got added along with power consumption metrics

I've submitted a PR for this feature: https://github.com/home-assistant/core/pull/98081

image

@legomind feel free to give this branch a go on your system and let me know if anything comes up.

Cisien avatar Aug 09 '23 01:08 Cisien

Awesome glad to see this being done. Looks great. Cant wait for it to be merged.

Happy to help test anything if needed. I have most of the smart power devices

starsoccer avatar Aug 10 '23 15:08 starsoccer

Awesome glad to see this being done. Looks great. Cant wait for it to be merged.

Happy to help test anything if needed. I have most of the smart power devices

Its merged so available on dev shortly :)

So @Cisien has provided power measurement sensors for all pdu. I think he also wants to enable relay control for the other devices as well which are not already supported.

Kane610 avatar Aug 10 '23 16:08 Kane610

so, i think the change i'm proposing in https://github.com/Kane610/aiounifi/issues/427 would magically start supporting PDU outlet switches, as well as letting us update the change I made in that PR to use the more self-documenting properties instead of a "caps" bitfield.

Also, I just added a new PR for reading the AC outlet budget/consumption metrics

Cisien avatar Aug 10 '23 17:08 Cisien

That's exactly what it will do! image

Cisien avatar Aug 10 '23 17:08 Cisien

😄 this is great I cant wait for it to hit main/release and use it

starsoccer avatar Aug 10 '23 19:08 starsoccer

We have merged @Cisien next PR with total power consu.ption of a pdu

Kane610 avatar Aug 12 '23 17:08 Kane610

Just merged extended support for controlling outlet relays for PDUs. I think we can close this issue now.

Kane610 avatar Aug 13 '23 18:08 Kane610

Thanks for getting this added @Kane610 and @Cisien We appreciate your commitment to this integration.

stephack avatar Aug 13 '23 19:08 stephack

Thanks! But the kudos should go to @Cisien who put in the effort :)

Kane610 avatar Aug 13 '23 19:08 Kane610

Thanks! But the kudos should go to @Cisien who put in the effort :)

Updated my kudos accordingly 😉

stephack avatar Aug 13 '23 19:08 stephack

Thanks! Let me know if you run into any issues!

I'm guessing this is in the pipeline for the August (September?) release?

Cisien avatar Aug 13 '23 19:08 Cisien

I'm guessing this is in the pipeline for the August (September?) release?

Yes the beta will be on the 30th of August

Kane610 avatar Aug 13 '23 20:08 Kane610

Beta is out and we can consider this issue completed. Thanks for your excellent contribution @Cisien

Kane610 avatar Sep 02 '23 07:09 Kane610