diff options
author | Ivan Martinez <ivanfmartinez@users.noreply.github.com> | 2017-01-11T00·55-0200 |
---|---|---|
committer | Matthew Garrett <mjg59-github@srcf.ucam.org> | 2017-04-22T19·42-0700 |
commit | 76dd4cfc70fa95ae703c680998757be180deed36 (patch) | |
tree | f8d82ba8b7acaa624397503b7ee02a8e4319948f /cli/broadlink_discovery | |
parent | 846cc353665154d7f38623154abe6cada0bf6a45 (diff) |
command line programs to control broadlink devices
Diffstat (limited to 'cli/broadlink_discovery')
-rwxr-xr-x | cli/broadlink_discovery | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/cli/broadlink_discovery b/cli/broadlink_discovery new file mode 100755 index 000000000000..84d96dfec668 --- /dev/null +++ b/cli/broadlink_discovery @@ -0,0 +1,25 @@ +#!/usr/bin/python + +import broadlink +import time +import argparse + +parser = argparse.ArgumentParser(fromfile_prefix_chars='@'); +parser.add_argument("--timeout", type=int, default=5, help="timeout to wait for receiving discovery responses") +args = parser.parse_args() + +print "discover" +devices = broadlink.discover(timeout=args.timeout) +#print devices +for device in devices: + if device.auth(): + print "###########################################" +# print device + print device.type + print "# broadlink_cli --type 0x2712 --host {} --mac {}".format(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 "0x2712 {} {}".format(device.host[0], ''.join(format(x, '02x') for x in device.mac)) + print "temperature = {}".format(device.check_temperature()) + print "" + else: + print "Error authenticating with device : {}".format(device.host) |