about summary refs log tree commit diff
path: root/cli/broadlink_cli
diff options
context:
space:
mode:
authorLiran BG <liranbg@users.noreply.github.com>2019-10-09T13·44+0300
committerDaniel Høyer Iversen <mail@dahoiv.net>2019-10-09T13·44+0300
commitcbb1d67df81cb27a213430f6b9924b386aa4c1f7 (patch)
tree5bbcb7c86976a736e37f144c5188183db80bd8a4 /cli/broadlink_cli
parent56e444cacf67c1bfb1337060bb2d39870dcbfe3f (diff)
Print base64 RF learned command output (#286)
* Print base64 RF learned command output

Would be helpful for hassio fans, they can easily copy paste the output into their automation configuration file.

* Update broadlink_cli
Diffstat (limited to 'cli/broadlink_cli')
-rwxr-xr-xcli/broadlink_cli2
1 files changed, 2 insertions, 0 deletions
diff --git a/cli/broadlink_cli b/cli/broadlink_cli
index 976b5373aa18..e608544364a6 100755
--- a/cli/broadlink_cli
+++ b/cli/broadlink_cli
@@ -225,6 +225,8 @@ if args.rfscanlearn:
             else ''.join(format(x, '02x') for x in bytearray(data))
         if args.learnfile is None:
             print(learned)
+            decode_hex = codecs.getdecoder("hex_codec")
+            print("Base64: {}".format(str(base64.b64encode(decode_hex(learned)[0])).decode('utf8')))
         if args.learnfile is not None:
             print("Saving to {}".format(args.learnfile))
             with open(args.learnfile, "w") as text_file: