Closed MHx489 closed 2 hours ago
uhubctl focus is to provide a functionality of switching USB power off and on, and getting basic information about connected USB hubs and devices. Various smart home integrations (Home Assistant, HomeKit etc) are not in scope.
However, there are few other projects that utilized uhubctl to provide such integrations. I recommend reading this article (featured in list of notable projects) https://medium.com/@soukron/how-to-manage-remotely-a-cinema-lightbox-rpi-uhubctl-homebridge-a933e6e178a5. I'm sure there are many different ways to do that integration. Note that if you intend to make it work on Raspberry Pi 5, it has a behavior that makes it different from any previous Raspberry Pi versions - namely, you have to execute it twice for locations 2 and 4 to actually turn power off for all ports - check readme section for Raspberry Pi 5. In all previous versions, it was always possible to turn power off with just a single command.
I used this nice function long time at different RPi's and did some automation with JS scripts at ioBroker. Like turn on/off USB power for USB Fans if temperatures going up and down inside a rack. I switched over to home assistant OS and couldnt find any solution to turn off the RPi 5 USB ports anymore, because it's running in docker and you can't much access the RPi system. Maybe it's possible for you to develop some intergration for home assistent. I think many people would love it, because i found a lot of users with same issues at my research and buying some Sonoff Smart USB adapter like others for that little function isn't much the case for me.