Skip to content

dmowcomber/usb-smart-switch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

usb-smart-switch

Allows you to control usb power through a HomeKit device using the uhubctl command and the hc library. This has only been tested on the Raspberry Pi with Raspberry Pi OS Buster.

WARNING

The method used to turn off a USB device is a bit heavy handed as it turns off all USB ports and should be used in a headless Raspberry Pi setup where you don't depend a USB keyboard, mouse, or and other USB device.

Dependencies

uhubctl is required and can be installed on debian based distros with apt:

sudo apt install -y uhubctl

Run

The uhubctl command requires root access so you can build and run with the following command:

go build .
sudo ./usb-smart-switch

Run at boot

One way to run this command at boot is to add the following to /etc/rc.local:

usbSmartSwitchDir={path_to_usb-smart-switch}
cd ${usbSmartSwitchDir}
${usbSmartSwitchDir}/usb-smart-switch &

About

A HomeKit compatible USB smart switch

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages