Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dmowcomber/usb-smart-switch

A HomeKit compatible USB smart switch
https://github.com/dmowcomber/usb-smart-switch

go homekit uhubctl usb

Last synced: about 1 month ago
JSON representation

A HomeKit compatible USB smart switch

Awesome Lists containing this project

README

        

# usb-smart-switch
Allows you to control usb power through a HomeKit device using the [uhubctl](https://github.com/mvp/uhubctl) command and the [hc](https://github.com/brutella/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 &
```