mirror of
https://github.com/mjg59/python-broadlink.git
synced 2024-11-14 11:30: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:
parent
2e2c8ef1a1
commit
3d4789305e
@ -19,6 +19,7 @@ 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 "# 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 "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 "0x2712 {} {}".format(device.host[0], ''.join(format(x, '02x') for x in device.mac))
|
||||||
|
if hasattr(device, 'check_temperature'):
|
||||||
print "temperature = {}".format(device.check_temperature())
|
print "temperature = {}".format(device.check_temperature())
|
||||||
print ""
|
print ""
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user