mirror of
https://github.com/mjg59/python-broadlink.git
synced 2024-11-22 07:00:12 +01:00
Checking device arg too for defining dev instance (#129)
This commit is contained in:
parent
8bc67af6d7
commit
9ff6fa817b
@ -87,7 +87,7 @@ elif args.mac:
|
|||||||
host = args.host
|
host = args.host
|
||||||
mac = bytearray.fromhex(args.mac)
|
mac = bytearray.fromhex(args.mac)
|
||||||
|
|
||||||
if args.host:
|
if args.host or args.device:
|
||||||
dev = broadlink.gendevice(type, (host, 80), mac)
|
dev = broadlink.gendevice(type, (host, 80), mac)
|
||||||
dev.auth()
|
dev.auth()
|
||||||
|
|
||||||
@ -123,11 +123,10 @@ if args.learn or args.learnfile:
|
|||||||
if args.durations \
|
if args.durations \
|
||||||
else ''.join(format(x, '02x') for x in bytearray(data))
|
else ''.join(format(x, '02x') for x in bytearray(data))
|
||||||
if args.learn:
|
if args.learn:
|
||||||
print learned
|
print learned
|
||||||
if args.learnfile:
|
if args.learnfile:
|
||||||
print "Saving to {}".format(args.learnfile)
|
print "Saving to {}".format(args.learnfile)
|
||||||
with open(args.learnfile, "w") as text_file:
|
with open(args.learnfile, "w") as text_file:
|
||||||
text_file.write(learned)
|
text_file.write(learned)
|
||||||
else:
|
else:
|
||||||
print "No data received..."
|
print "No data received..."
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user