receiver: handle devices with serial numbers that don't provide number of pairings

This commit is contained in:
Peter F. Patel-Schneider 2020-08-19 10:13:26 -04:00
parent f5c63ccc39
commit 04e8281738
1 changed files with 2 additions and 0 deletions

View File

@ -381,6 +381,8 @@ class Receiver(object):
if serial_reply: if serial_reply:
self.serial = _strhex(serial_reply[1:5]) self.serial = _strhex(serial_reply[1:5])
self.max_devices = ord(serial_reply[6:7]) self.max_devices = ord(serial_reply[6:7])
if self.max_devices <= 0 or self.max_devices > 6:
self.max_devices = product_info.get('max_devices', 1)
# TODO _properly_ figure out which receivers do and which don't support unpairing # TODO _properly_ figure out which receivers do and which don't support unpairing
# This code supposes that receivers that don't unpair support a pairing request for device index 0 # This code supposes that receivers that don't unpair support a pairing request for device index 0
self.may_unpair = self.write_register(_R.receiver_pairing) is None self.may_unpair = self.write_register(_R.receiver_pairing) is None