Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Lots of issues here #6

Open
wrybread opened this issue Jan 27, 2018 · 1 comment
Open

Lots of issues here #6

wrybread opened this issue Jan 27, 2018 · 1 comment

Comments

@wrybread
Copy link

wrybread commented Jan 27, 2018

I had a surprising number of issues installing and running this package.

  1. I don't think it's actually available on pip, so the installation instructions here don't work

  2. installing from source, I had to change "usbarray" to "usbrelay" in setup.py.

  3. 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.

  1. 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?

  1. 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:

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:

#!/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)
@wrybread wrybread changed the title Lots of issues with the instructions here Lots of issues here Jan 27, 2018
@patrickjahns
Copy link
Owner

@wrybread

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 free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants