From d81a17ef610ee9d9d902f568c8c3de57e238abe6 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sat, 2 Apr 2022 18:58:21 -0400 Subject: [PATCH] Don't try to update if there is no print time estimate --- octoprint_reservations/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/octoprint_reservations/main.py b/octoprint_reservations/main.py index 70f2cce..45074e3 100755 --- a/octoprint_reservations/main.py +++ b/octoprint_reservations/main.py @@ -18,7 +18,10 @@ def get_printer_job(calendar, printer): print(f"Failed to get current job for {printer['name']}: {e}") return - if current_job["state"] == "Printing": + if ( + current_job["state"] == "Printing" + and current_job["progress"]["printTimeLeft"] is not None + ): now = datetime.utcnow() start = now - timedelta(seconds=current_job["progress"]["printTime"]) estimated_end = now + timedelta(