KMtronic usb relay help **solved**

All about the standard Meteobridge devices based on mobile routers from TP-Link, D-Link, ASUS

Moderator: Mattk

Post Reply
whortas
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: Thu Jan 22, 2015 10:43 pm

KMtronic usb relay help **solved**

Post by whortas »

Hi
My System
TP-LINK TL-MR3020 FW 1.4
SW- 2.6 build 7252
USB hub 4 ports
Vp2 usb

I Have this KMtronic USB Relay Controller-One Channel-BOX (SS_USB1REL_BOX)connecter to the hub.
I want to call usb relay due to alarm event.
I create an event alarm and use the URL"http://templates.meteobridge.com/usbswitch.sh"
In "Parameter:" put the number 1
I fire alarm and clear it several times testing all free ports of the usb hub
In "Serial USB Switch" I try all 4 ports.
I have try to use the relay but without success.
in RPI I call "'\xff\x01\x01' > /dev/ttyUSB0" and it works.
What I'm doing wrong ?
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7874
Joined: Mon Oct 01, 2007 10:51 pm

Re: KMtronic usb relay help

Post by admin »

Could you please give me remote access as described here:
viewtopic.php?f=57&t=9885

Please send URL and password to "info(at)meteobridge.com".
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7874
Joined: Mon Oct 01, 2007 10:51 pm

Re: KMtronic usb relay help

Post by admin »

Beside a bug in the usbswitch script it turned out that testing a USB relay can be a bit cumbersome.
Therefore, you might find this definition helpful, which toggles the relay each minute.
Screen Shot 2015-11-03 at 19.52.11.png
Screen Shot 2015-11-03 at 19.52.11.png (28.82 KiB) Viewed 2108 times
This is how it works:
  • * the script is executed every minute
    * script parameter is the result of a numerical computation, which is indicated by {* and *} brackets
    * [m] reports the current minute, % 2 takes the minute modulus 2 which means that every even minute the result is 0, on odd minutes the result is 1
    * the comparison = 0 returns 1 when true or 0 when false
    * usbswitch script is called with parameters 0 and 1 changing each minute

Yes, you can also omit the comparison and say {* [m] % 2 *} but I wanted to show the comparison as it might be helpful on other occasions.
Post Reply