diff --git a/lib/logitech_receiver/device.py b/lib/logitech_receiver/device.py index da65ea91..cd5c2796 100644 --- a/lib/logitech_receiver/device.py +++ b/lib/logitech_receiver/device.py @@ -376,8 +376,7 @@ class Device: if changed or reason: # update the leds on the device, if any _hidpp10.set_3leds(self, info.level, charging=info.charging(), warning=bool(alert)) - if hasattr(self, "status"): - self.changed(active=True, alert=alert, reason=reason) + self.changed(active=True, alert=alert, reason=reason) # Retrieve and regularize battery status def read_battery(self): @@ -525,7 +524,7 @@ class Device: __nonzero__ = __bool__ def status_string(self): - return self.battery_info.to_str() if hasattr(self, "status") and self.battery_info is not None else "" + return self.battery_info.to_str() if self.battery_info is not None else "" def __str__(self): try: diff --git a/lib/solaar/listener.py b/lib/solaar/listener.py index 34cf8ad8..da09bca8 100644 --- a/lib/solaar/listener.py +++ b/lib/solaar/listener.py @@ -279,8 +279,8 @@ def ping_all(resuming=False): logger.info("ping all devices%s", " when resuming" if resuming else "") for listener_thread in _all_listeners.values(): if listener_thread.receiver.isDevice: - if resuming and hasattr(listener_thread.receiver, "status"): - listener_thread.receiver.status._active = None # ensure that settings are pushed + if resuming: + listener_thread.receiver._active = None # ensure that settings are pushed if listener_thread.receiver.ping(): listener_thread.receiver.changed(active=True, push=True) listener_thread._status_changed(listener_thread.receiver)