KMTronic USB One Relay Linux test script
Download test script from:
http://www.info.kmtronic.com/software/USB_Relays/KMtronic_USB_Relay_Linux_Script_OpenSUSE.zip
http://www.info.kmtronic.com/software/USB_Relays/KMtronic_USB_Relay_Linux_Script_Ubuntu.zip
(Thanks to Karl for this script)
-------------------------
Create folder and extract these 4 files :
You will need to mark it as executable with this command
chmod + x *.*
1. ubrelayspeed.sh - This script will set the speed to 9600
2. usbrelayon.sh - This script will switch "ON" the relay
3. usbrelayoff.sh - This script will switch "OFF" the relay
4. usbrelaystatus.sh - This script will read the status of the relay
-----------------------------------
The script “usbrelaystatus” gets the status of the relay (on/off) and there are places to insert code to run commands. Hopefully included comments explain things (I left the echo’s and comments in that I used while I wrote/tested the script). Let me know if you have questions.
If you do test this, I’d appreciate knowing if it worked for you or not.
I’m using OpenSUSE 12.1 – had to install libftdi1 – but it came with the OpenSUSE 12.1 install.
I never got the “.cats” program to work.
The usbrelaystatus script does not require any other programs to be installed (except for the ftdi drivers – at least on my system)
And I also discovered I have to run the usbrelayspeed script before I can send/receive data to/from the usb relay card.
Also I discovered if I include the usbrelayspeed in a cron job @reboot it doesn’t work – perhaps the @reboot executes before the usb relay card is loaded.
I am not a computer expert, so there may be a more efficient/better way to get the status of the relay – if you/someone publishes a better way I won’t feel sad. But this works.
Hope this saves someone some time.
Karl
---------------------