Update device status handling in app.py
Change device status check to warn on non-ONLINE states.
This commit is contained in:
@@ -175,12 +175,12 @@ def get_device():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
status = (d.get("status") or "").upper()
|
status = (d.get("status") or "").upper()
|
||||||
# accept ONLINE/CONNECTED; some setups use different strings
|
if status not in {"ONLINE", "CONNECTED"}:
|
||||||
if status in {"ONLINE", "CONNECTED"}:
|
# just a warning; do not fail
|
||||||
|
print(f"[WARN] Device status is {status}, continuing anyway...")
|
||||||
return jd.get_device(d["name"])
|
return jd.get_device(d["name"])
|
||||||
|
|
||||||
# sometimes myjdapi reports UNKNOWN briefly; give it time
|
|
||||||
time.sleep(2)
|
|
||||||
|
|
||||||
# no ONLINE device after waiting
|
# no ONLINE device after waiting
|
||||||
if last:
|
if last:
|
||||||
|
|||||||
Reference in New Issue
Block a user