Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/dmowcomber/usb-smart-switch
- Owner: dmowcomber
- License: apache-2.0
- Created: 2023-08-26T04:29:12.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-08-26T14:07:37.000Z (over 1 year ago)
- Last Synced: 2024-06-21T18:53:19.139Z (7 months ago)
- Topics: go, homekit, uhubctl, usb
- Language: Go
- Homepage:
- Size: 2.22 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 &
```