abudden / OctoPrint-USBRelayControl

Plugin for OctoPrint for controlling HID-based USB relays
GNU Affero General Public License v3.0
11 stars 2 forks source link

OctoPrint USB Relay Control

USB Relay Control adds a sidebar with on/off buttons. You can add as many buttons as you want that will control each USB Relay connected to your Raspberry Pi.

Very useful if you want to add some electronic/improvements to your printer.

GpioControl GpioControl

Note that the layout of the settings in the plugin configuration menu is awful. If anyone knows their way round jinja2 and would like to help fix this, I'd very grateful!

Setup

Install via the bundled Plugin Manager or manually using this URL:

https://github.com/abudden/OctoPrint-USBRelayControl/archive/master.zip

The module depends on the hidapi module, which should be installed automatically. If you have any issues, try installing these packages before installing the plugin:

sudo apt-get install python3-dev libusb-1.0-0-dev libudev-dev

You'll also need to make sure that the USB relay can be controlled without root privileges.

For example, edit /etc/udev/rules.d/99-usbrelay.rules and add this line:

SUBSYSTEM=="usb", ATTR{idVendor}=="16c0", ATTR{idProduct}=="05df", MODE="777"

Then restart your computer.

The vendor ID and product ID (which you'll also need in the octoprint configuration) can be found using the lsusb command. The easiest way to do this is to run lsusb, then plug your device in, then run lsusb again. One new line should have appeared and this will contain the ID XXXX:YYYY where XXXX is the vendor ID and YYYY is the product ID.

Configuration

Just add correct relay configuration:

Note that there's very little in the way of error checking, so if you put incorrect values into any of the fields, it'll probably break something.

Credits

This plugin was created as a combination of two other excellent projects: