Ejemplo n.º 1
0
                    action="store_true",
                    help="print debug information")
'''
parser.add_argument("--host", metavar="HOSTNAME", action="store",
                    help="Specifies the host or IP address of the light controller.")
parser.add_argument("color", metavar="WWRRGGBB", type=str, nargs=1,
                    help="Specifies the color code.")
parser.add_argument("-t", "--time", metavar="SECONDS", type=float,
                    help="Fade duration. Defaults to 0.")
parser.add_argument("-l", "--limit-brightness", action="store_true",
                    help="don't increase brightness")
'''
parser.set_defaults(host="tcp:127.0.0.1:9910", time=10)
args = parser.parse_args()
'''
try:
  color = int(args.color[0], 16)
except ValueError:
  parser.print_usage(file=sys.stderr)
  sys.stderr.write("error: expected hexadecimal color code\n")
  sys.exit(1)
'''
# Connect to device
if (args.verbose):
    printer = print
else:
    printer = lambda x: None
fibre_tcp = fibre.find_any(path=(args.host), timeout=5)

print(fibre_tcp.fw_version_major)
Ejemplo n.º 2
0
        print(str(ex))
        sys.exit(1)
elif not args.serial is None:
    my_device = fibre.open_serial(args.serial,
                                  printer=printer,
                                  device_stdout=print)
elif not args.udp is None:
    my_device = fibre.open_udp(args.udp, printer=printer, device_stdout=print)
elif not args.tcp is None:
    my_device = fibre.open_tcp(args.tcp, printer=printer, device_stdout=print)
else:
    print("Waiting for device...")
    consider_usb = 'usb' in args.discover.split(',')
    consider_serial = 'serial' in args.discover.split(',')
    my_device = fibre.find_any(consider_usb,
                               consider_serial,
                               printer=printer,
                               device_stdout=print)
print("Connected!")

try:
    # If this assignment works, we are already in interactive mode.
    # so just drop out of script to existing shell
    interpreter = sys.ps1
except AttributeError:
    # We are not in interactive mode, so let's fire one up
    # Though let's be real, IPython is the way to go
    print(
        'If you want to have an improved interactive console with pretty colors,'
    )
    print(
        'you can run this script in interactive mode with IPython with this command:'
Ejemplo n.º 3
0
                    action="store_true",
                    help="print debug information")
'''
parser.add_argument("--host", metavar="HOSTNAME", action="store",
                    help="Specifies the host or IP address of the light controller.")
parser.add_argument("color", metavar="WWRRGGBB", type=str, nargs=1,
                    help="Specifies the color code.")
parser.add_argument("-t", "--time", metavar="SECONDS", type=float,
                    help="Fade duration. Defaults to 0.")
parser.add_argument("-l", "--limit-brightness", action="store_true",
                    help="don't increase brightness")
'''
parser.set_defaults(host="serial:COM4", time=0)
args = parser.parse_args()
'''
try:
  color = int(args.color[0], 16)
except ValueError:
  parser.print_usage(file=sys.stderr)
  sys.stderr.write("error: expected hexadecimal color code\n")
  sys.exit(1)
'''
# Connect to device
if (args.verbose):
    printer = print
else:
    printer = lambda x: None
fibre_serial = fibre.find_any(path=(args.host), timeout=5)

print(fibre_serial.fw_version_major)