Update device status handling in app.py

Change device status check to warn on non-ONLINE states.
This commit is contained in:
2025-12-31 12:49:07 +01:00
committed by GitHub
parent 7fe5a410cc
commit 5bddd63ec1

View File

@@ -174,13 +174,13 @@ def get_device():
time.sleep(2)
continue
status = (d.get("status") or "").upper()
# accept ONLINE/CONNECTED; some setups use different strings
if status in {"ONLINE", "CONNECTED"}:
return jd.get_device(d["name"])
status = (d.get("status") or "").upper()
if status not in {"ONLINE", "CONNECTED"}:
# just a warning; do not fail
print(f"[WARN] Device status is {status}, continuing anyway...")
return jd.get_device(d["name"])
# sometimes myjdapi reports UNKNOWN briefly; give it time
time.sleep(2)
# no ONLINE device after waiting
if last: