diff options
author | Julian Pastarmov <pastarmovj@gmail.com> | 2017-11-25T20·04+0100 |
---|---|---|
committer | Matthew Garrett <mjg59-github@srcf.ucam.org> | 2017-11-25T20·04-0800 |
commit | 3d4789305e64a842c2b1a86d4b62ade3fa38d2a2 (patch) | |
tree | b7b1e975c54b52843acbb289498212036dd77af1 /cli/broadlink_discovery | |
parent | 2e2c8ef1a15175cf311f757a52e7c561f834f68b (diff) |
Only get temperature for devices that support it. (#102)
Calling check_temperature is only possible on the RM family of devices. The program used to crash if other types of devices were discovered (A1, MP1 etc.).
Diffstat (limited to 'cli/broadlink_discovery')
-rwxr-xr-x | cli/broadlink_discovery | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cli/broadlink_discovery b/cli/broadlink_discovery index 84d96dfec668..13c65e7a7f14 100755 --- a/cli/broadlink_discovery +++ b/cli/broadlink_discovery @@ -19,7 +19,8 @@ for device in devices: 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()) + if hasattr(device, 'check_temperature'): + print "temperature = {}".format(device.check_temperature()) print "" else: print "Error authenticating with device : {}".format(device.host) |