mirror of
https://github.com/mjg59/python-broadlink.git
synced 2024-11-22 07:00:12 +01:00
Allow to specify local_ip_address when discovering (#272)
This commit is contained in:
parent
9d9b49c3db
commit
1cea255dce
@ -6,10 +6,11 @@ import argparse
|
|||||||
|
|
||||||
parser = argparse.ArgumentParser(fromfile_prefix_chars='@');
|
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")
|
||||||
|
parser.add_argument("--ip", default=None, help="ip address to use in the discovery")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
print("Discovering...")
|
print("Discovering...")
|
||||||
devices = broadlink.discover(timeout=args.timeout)
|
devices = broadlink.discover(timeout=args.timeout, local_ip_address=args.ip)
|
||||||
for device in devices:
|
for device in devices:
|
||||||
if device.auth():
|
if device.auth():
|
||||||
print("###########################################")
|
print("###########################################")
|
||||||
@ -22,3 +23,4 @@ for device in devices:
|
|||||||
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