From d5a6ef058a30577fd875c396a6cb887229e4f6af Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Tue, 21 Dec 2021 11:02:37 -0500 Subject: [PATCH] device: check for uninitialized protocol when pinging --- lib/logitech_receiver/device.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/logitech_receiver/device.py b/lib/logitech_receiver/device.py index 4e8c23fa..c7c03261 100644 --- a/lib/logitech_receiver/device.py +++ b/lib/logitech_receiver/device.py @@ -397,9 +397,8 @@ class Device: def ping(self): """Checks if the device is online, returns True of False""" - protocol = _base.ping( - self.handle or self.receiver.handle, self.number, long_message=self.bluetooth or self._protocol >= 2.0 - ) + long = self.bluetooth or self._protocol is not None and self._protocol >= 2.0 + protocol = _base.ping(self.handle or self.receiver.handle, self.number, long_message=long) self.online = protocol is not None if protocol: self._protocol = protocol