diff options
Diffstat (limited to 'cli/broadlink_cli')
-rwxr-xr-x | cli/broadlink_cli | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cli/broadlink_cli b/cli/broadlink_cli index 1c3e231d69e5..1a8fe5703468 100755 --- a/cli/broadlink_cli +++ b/cli/broadlink_cli @@ -4,6 +4,8 @@ import broadlink import sys import argparse import time +import base64 +import codecs TICK = 32.84 IR_TOKEN = 0x26 @@ -120,7 +122,7 @@ if args.send: data = durations_to_broadlink(parse_durations(' '.join(args.data))) \ if args.durations else bytearray.fromhex(''.join(args.data)) dev.send_data(data) -if args.learn: +if args.learn or args.learnfile: dev.enter_learning() data = None print("Learning...") @@ -135,7 +137,8 @@ if args.learn: else ''.join(format(x, '02x') for x in bytearray(data)) if args.learn: print(learned) - print("Base64: " + base64.b64encode(learned.decode("hex"))) + decode_hex = codecs.getdecoder("hex_codec") + print("Base64: " + str(base64.b64encode(decode_hex(learned)[0]))) if args.learnfile: print("Saving to {}".format(args.learnfile)) with open(args.learnfile, "w") as text_file: |