You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.
There's three changes there: I changed the way I'm instantiating it (simpleusbrelay.simpleusbrelay, or could change the import to "from simpleusbrelay import simpleusbrelay") changed the keywords ("Vendor" instead of idVendor and "Product" instead of "idProduct"), and converted the hex to integers.
to turn on or off all relays, the line is:
relaycontroller.array_on("all")
(Note the quotation marks around "all")
And I get an error about the resource being busy unless I reinstantiate simpleusbrelay before executing the next command. Does anyone have any idea why that is?
needs to be run as root. I gather that's fixable with a udev rule but I haven't gotten that working yet. There's some instructions here though:
And note that there's another utility, usbrelay, available at the above link that works well as a commandline option. Easily installed under Debian with "apt-get install usbrelay", and it will install the udev rules.
Also note that this package (simpleusbrelay) will monopolize the usb relay even after exiting the program, since there's no way that I can see to close the module. So after running it, will need to unplug the module or reboot before trying another method of controlling it (such as usbrelay).
Here's my working demo code for simpleusbrelay:
#!/usr/bin/python
import simpleusbrelay # requires pyusb
import time
for i in range(5):
# turn on relay 2
relaycontroller= simpleusbrelay.simpleusbrelay(Vendor = int("16c0", 16) , Product = int("05df", 16) )
relaycontroller.array_on(2)
time.sleep(.1)
# turn off relay 2
relaycontroller= simpleusbrelay.simpleusbrelay(Vendor = int("16c0", 16) , Product = int("05df", 16) )
relaycontroller.array_off(2)
time.sleep(.1)
# turn on all
relaycontroller= simpleusbrelay.simpleusbrelay(Vendor = int("16c0", 16) , Product = int("05df", 16) )
relaycontroller.array_on("all")
time.sleep(.1)
# turn off all
relaycontroller= simpleusbrelay.simpleusbrelay(Vendor = int("16c0", 16) , Product = int("05df", 16) )
relaycontroller.array_off("all")
time.sleep(.1)
The text was updated successfully, but these errors were encountered:
wrybread
changed the title
Lots of issues with the instructions here
Lots of issues here
Jan 27, 2018
Sorry for the delayed response - and thank you for providing the information
I don't think it's actually available on pip, so the installation instructions here don't work
It was once published on pypi - probably taken down - would need to check
Thank you very much for the overall feedback - however I won't be able to incorporate much of it right now, since I don't have the hardware necessary to test it.
However, since you already put a lot of effort in your notes - would you be interested in maintaining the package?
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I had a surprising number of issues installing and running this package.
I don't think it's actually available on pip, so the installation instructions here don't work
installing from source, I had to change "usbarray" to "usbrelay" in setup.py.
I had to instantiate it with:
relaycontroller = simpleusbrelay.simpleusbrelay(Vendor = int("16c0", 16) , Product = int("05df", 16) )
There's three changes there: I changed the way I'm instantiating it (simpleusbrelay.simpleusbrelay, or could change the import to "from simpleusbrelay import simpleusbrelay") changed the keywords ("Vendor" instead of idVendor and "Product" instead of "idProduct"), and converted the hex to integers.
relaycontroller.array_on("all")
(Note the quotation marks around "all")
And I get an error about the resource being busy unless I reinstantiate simpleusbrelay before executing the next command. Does anyone have any idea why that is?
https://github.com/darrylb123/usbrelay
And note that there's another utility, usbrelay, available at the above link that works well as a commandline option. Easily installed under Debian with "apt-get install usbrelay", and it will install the udev rules.
Also note that this package (simpleusbrelay) will monopolize the usb relay even after exiting the program, since there's no way that I can see to close the module. So after running it, will need to unplug the module or reboot before trying another method of controlling it (such as usbrelay).
Here's my working demo code for simpleusbrelay:
The text was updated successfully, but these errors were encountered: