migueltoy / drcontrol

Automatically exported from code.google.com/p/drcontrol
0 stars 0 forks source link

"list all states" only lists 7 of 8 relays #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
As you see, it only lists 7 relays if i use the "all"-option while it's 
possible to ask for the state of relay 8. It's version 0.12c

{{{
root@machine:~/drcontrol# ./drcontrol.py -h
Usage: drcontrol.py [options]

Options:
  -h, --help            show this help message and exit
  -d DEVICE, --device=DEVICE
                        The device serial, example A6VV5PHY
  -l, --list            List all devices
  -r RELAY, --relay=RELAY
                        Relay to command by number: 1...8 or all
  -c COMMAND, --command=COMMAND
                        State: on, off, state
  -v, --verbose         Verbose, print all info on screen
root@machine:~/drcontrol# ./drcontrol.py -v -l
DRControl 0.12
Vendor          Product                 Serial
FTDI            USB Serial Converter            FTG63F5K
FTDI            FT245R USB FIFO         A601S3OQ
wh Berlin               EMP800.14               whEMP00254594
root@machine:~/drcontrol# ./drcontrol.py -v -d A601S3OQ -r all -c state
DRControl 0.12
Device:         A601S3OQ
Send command:   Relay all (0xFF) to STATE
Relay 1 state:  OFF (0)
Relay 2 state:  OFF (0)
Relay 3 state:  OFF (0)
Relay 4 state:  OFF (0)
Relay 5 state:  OFF (0)
Relay 6 state:  OFF (0)
Relay 7 state:  OFF (0)
root@machine:~/drcontrol# ./drcontrol.py -v -d A601S3OQ -r all -c on
DRControl 0.12
Device:         A601S3OQ
Send command:   Relay all (0xFF) to ON
Relay all to ON
root@machine:~/drcontrol# ./drcontrol.py -v -d A601S3OQ -r 8 -c on
DRControl 0.12
Device:         A601S3OQ
Send command:   Relay 8 (0x40) to ON
Relay 8 to ON
root@machine:~/drcontrol# ./drcontrol.py -v -d A601S3OQ -r 8 -c on
DRControl 0.12
Device:         A601S3OQ
Send command:   Relay 8 (0x40) to ON
Relay 8 to ON
root@machine:~/drcontrol# ./drcontrol.py -v -d A601S3OQ -r all -c on
DRControl 0.12
Device:         A601S3OQ
Send command:   Relay all (0xFF) to ON
Relay all to ON
root@machine:~/drcontrol# ./drcontrol.py -v -d A601S3OQ -r all -c state
DRControl 0.12
Device:         A601S3OQ
Send command:   Relay all (0xFF) to STATE
Relay 1 state:  ON (2)
Relay 2 state:  ON (8)
Relay 3 state:  ON (32)
Relay 4 state:  ON (128)
Relay 5 state:  ON (4)
Relay 6 state:  ON (16)
Relay 7 state:  ON (64)
root@machine:~/drcontrol# ./drcontrol.py -v -d A601S3OQ -r all -c off
DRControl 0.12
Device:         A601S3OQ
Send command:   Relay all (0xFF) to OFF
Relay all to OFF
root@machine:~/drcontrol# ./drcontrol.py -v -d A601S3OQ -r all -c on
DRControl 0.12
Device:         A601S3OQ
Send command:   Relay all (0xFF) to ON
Relay all to ON
root@machine:~/drcontrol# ./drcontrol.py -v -d A601S3OQ -r 8 -c off
DRControl 0.12
Device:         A601S3OQ
Send command:   Relay 8 (0x40) to OFF
Relay 8 to OFF
}}}

Original issue reported on code.google.com by ladiko on 29 Aug 2013 at 12:37

GoogleCodeExporter commented 8 years ago
Ohh it's an Ubuntu 12.04.3 machine, if that is important

Original comment by ladiko on 29 Aug 2013 at 12:38

GoogleCodeExporter commented 8 years ago
And this usb relay card: www.ebay.com/itm/300931309072
Beside the named minor issue, your script works well

Original comment by ladiko on 29 Aug 2013 at 12:41

GoogleCodeExporter commented 8 years ago
I can second this.  seen it on debian on a Dell laptop and on the Raspberry 
debian. Both with a Sainsmart board.  I recognize this was designed for another 
board and that could be the issue. The open close relays work perfectly though. 

Original comment by c...@mc.edu on 17 May 2014 at 2:27

GoogleCodeExporter commented 8 years ago
The fix is easy:
line 193 of drcontrol.py, it should be "range(1,9)" instead of "range(1,8)"

Original comment by sylvain....@gmail.com on 4 Jun 2014 at 4:49