ui: better handling of missing devices

This commit is contained in:
Peter F. Patel-Schneider 2026-03-12 10:52:30 -04:00
parent 940aae1be1
commit 51532252df
2 changed files with 9 additions and 4 deletions

View File

@ -314,10 +314,13 @@ def ping_all(resuming=False):
for dev in listener_thread.receiver:
if resuming:
dev._active = None # ensure that settings are pushed
if dev.ping():
dev.changed(active=True, push=True)
listener_thread._status_changed(dev)
count -= 1
try: # sometimes the device is not set up already, it should come back later
if dev.ping():
dev.changed(active=True, push=True)
listener_thread._status_changed(dev)
except exceptions.NoSuchDevice:
logger.debug("can't ping device on resume: %s", dev)
if not count:
break

View File

@ -122,7 +122,9 @@ def run_loop(
def _status_changed(device, alert, reason, refresh=False):
assert device is not None
if device is None:
logger.debug("status changed on nil device: %s (%s) %s", device, alert, reason)
return
logger.debug("status changed: %s (%s) %s", device, alert, reason)
if alert is None:
alert = Alert.NONE