1
0
mirror of https://github.com/mjg59/python-broadlink.git synced 2024-11-14 03:20:14 +01:00

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.).
This commit is contained in:
Julian Pastarmov 2017-11-25 21:04:10 +01:00 committed by Matthew Garrett
parent 2e2c8ef1a1
commit 3d4789305e

View File

@ -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)