mirror of
https://github.com/mjg59/python-broadlink.git
synced 2024-11-22 15:10:12 +01:00
2to3 broadlink_discovery (#245)
This commit is contained in:
parent
b8fdf337c9
commit
ef66997953
@ -8,17 +8,17 @@ parser = argparse.ArgumentParser(fromfile_prefix_chars='@');
|
|||||||
parser.add_argument("--timeout", type=int, default=5, help="timeout to wait for receiving discovery responses")
|
parser.add_argument("--timeout", type=int, default=5, help="timeout to wait for receiving discovery responses")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
print "Discovering..."
|
print("Discovering...")
|
||||||
devices = broadlink.discover(timeout=args.timeout)
|
devices = broadlink.discover(timeout=args.timeout)
|
||||||
for device in devices:
|
for device in devices:
|
||||||
if device.auth():
|
if device.auth():
|
||||||
print "###########################################"
|
print("###########################################")
|
||||||
print device.type
|
print(device.type)
|
||||||
print "# broadlink_cli --type {} --host {} --mac {}".format(hex(device.devtype), device.host[0], ''.join(format(x, '02x') for x in device.mac))
|
print("# broadlink_cli --type {} --host {} --mac {}".format(hex(device.devtype), device.host[0], ''.join(format(x, '02x') for x in device.mac)))
|
||||||
print "Device file data (to be used with --device @filename in broadlink_cli) : "
|
print("Device file data (to be used with --device @filename in broadlink_cli) : ")
|
||||||
print "{} {} {}".format(hex(device.devtype), device.host[0], ''.join(format(x, '02x') for x in device.mac))
|
print("{} {} {}".format(hex(device.devtype), device.host[0], ''.join(format(x, '02x') for x in device.mac)))
|
||||||
if hasattr(device, 'check_temperature'):
|
if hasattr(device, 'check_temperature'):
|
||||||
print "temperature = {}".format(device.check_temperature())
|
print("temperature = {}".format(device.check_temperature()))
|
||||||
print ""
|
print("")
|
||||||
else:
|
else:
|
||||||
print "Error authenticating with device : {}".format(device.host)
|
print("Error authenticating with device : {}".format(device.host))
|
||||||
|
Loading…
Reference in New Issue
Block a user