From e89b50cdf258ad55dec67e01c54b2110561d0f15 Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Thu, 23 Jan 2020 17:17:36 -0500 Subject: [PATCH] cli: correct reporting for pairing with receivers that re-pair (i.e., c534) --- lib/solaar/cli/pair.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/solaar/cli/pair.py b/lib/solaar/cli/pair.py index 076d9ee1..3338a243 100644 --- a/lib/solaar/cli/pair.py +++ b/lib/solaar/cli/pair.py @@ -57,9 +57,13 @@ def run(receivers, args, find_receiver, _ignore): assert n if n.devnumber == 0xFF: _notifications.process(receiver, n) - elif n.sub_id == 0x41 and n.address == 0x04: + elif n.sub_id == 0x41: # allow for other protocols! (was and n.address == 0x04) if n.devnumber not in known_devices: receiver.status.new_device = receiver[n.devnumber] + elif receiver.re_pairs: + # unfortunately this breaks encapsulation but the nice way tries to unpair + del receiver._devices[n.devnumber] # get rid of information on device re-paired away + receiver.status.new_device = receiver[n.devnumber] timeout = 20 # seconds receiver.handle = _HandleWithNotificationHook(receiver.handle)