Add 'third_party/python/broadlink/' from commit '17968ef4d4'
git-subtree-dir: third_party/python/broadlink git-subtree-mainline:0f53060159git-subtree-split:17968ef4d4
This commit is contained in:
commit
9d94a727b2
10 changed files with 1836 additions and 0 deletions
27
third_party/python/broadlink/cli/broadlink_discovery
vendored
Executable file
27
third_party/python/broadlink/cli/broadlink_discovery
vendored
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
|
||||
import broadlink
|
||||
|
||||
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("--ip", default=None, help="ip address to use in the discovery")
|
||||
parser.add_argument("--dst-ip", default=None, help="destination ip address to use in the discovery")
|
||||
args = parser.parse_args()
|
||||
|
||||
print("Discovering...")
|
||||
devices = broadlink.discover(timeout=args.timeout, local_ip_address=args.ip, discover_ip_address=args.dst_ip)
|
||||
for device in devices:
|
||||
if device.auth():
|
||||
print("###########################################")
|
||||
print(device.type)
|
||||
print("# broadlink_cli --type {} --host {} --mac {}".format(hex(device.devtype), 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("{} {} {}".format(hex(device.devtype), device.host[0], ''.join(format(x, '02x') for x in device.mac)))
|
||||
if hasattr(device, 'check_temperature'):
|
||||
print("temperature = {}".format(device.check_temperature()))
|
||||
print("")
|
||||
else:
|
||||
print("Error authenticating with device : {}".format(device.host))
|
||||
Loading…
Add table
Add a link
Reference in a new issue