From 3d4789305e64a842c2b1a86d4b62ade3fa38d2a2 Mon Sep 17 00:00:00 2001 From: Julian Pastarmov Date: Sat, 25 Nov 2017 21:04:10 +0100 Subject: [PATCH] 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.). --- cli/broadlink_discovery | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cli/broadlink_discovery b/cli/broadlink_discovery index 84d96df..13c65e7 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)