device: remove checks for status attributes
This commit is contained in:
parent
dfd3d10c2e
commit
4a89a79a4d
|
@ -376,8 +376,7 @@ class Device:
|
||||||
if changed or reason:
|
if changed or reason:
|
||||||
# update the leds on the device, if any
|
# update the leds on the device, if any
|
||||||
_hidpp10.set_3leds(self, info.level, charging=info.charging(), warning=bool(alert))
|
_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
|
# Retrieve and regularize battery status
|
||||||
def read_battery(self):
|
def read_battery(self):
|
||||||
|
@ -525,7 +524,7 @@ class Device:
|
||||||
__nonzero__ = __bool__
|
__nonzero__ = __bool__
|
||||||
|
|
||||||
def status_string(self):
|
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):
|
def __str__(self):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -279,8 +279,8 @@ def ping_all(resuming=False):
|
||||||
logger.info("ping all devices%s", " when resuming" if resuming else "")
|
logger.info("ping all devices%s", " when resuming" if resuming else "")
|
||||||
for listener_thread in _all_listeners.values():
|
for listener_thread in _all_listeners.values():
|
||||||
if listener_thread.receiver.isDevice:
|
if listener_thread.receiver.isDevice:
|
||||||
if resuming and hasattr(listener_thread.receiver, "status"):
|
if resuming:
|
||||||
listener_thread.receiver.status._active = None # ensure that settings are pushed
|
listener_thread.receiver._active = None # ensure that settings are pushed
|
||||||
if listener_thread.receiver.ping():
|
if listener_thread.receiver.ping():
|
||||||
listener_thread.receiver.changed(active=True, push=True)
|
listener_thread.receiver.changed(active=True, push=True)
|
||||||
listener_thread._status_changed(listener_thread.receiver)
|
listener_thread._status_changed(listener_thread.receiver)
|
||||||
|
|
Loading…
Reference in New Issue