device: remove checks for status attributes

This commit is contained in:
Peter F. Patel-Schneider 2024-03-12 10:00:46 -04:00
parent dfd3d10c2e
commit 4a89a79a4d
2 changed files with 4 additions and 5 deletions

View File

@ -376,7 +376,6 @@ 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)
# Retrieve and regularize battery status
@ -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:

View File

@ -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)