From c23d99726d91b8baec6703df91e00c862dc23d2e Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Thu, 31 Jul 2025 19:16:08 -0600 Subject: [PATCH] Spacing --- server.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server.py b/server.py index 65d734f..adf820b 100644 --- a/server.py +++ b/server.py @@ -105,11 +105,13 @@ async def monitor_garage_door(app): except asyncio.TimeoutError: logging.warning("Request to camera timed out.") + PREDICTION_HISTORY.append('unknown') if len(PREDICTION_HISTORY) > PREDICTION_HISTORY_MAX_LENGTH: PREDICTION_HISTORY.pop(0) except aiohttp.ClientError as e: logging.error(f"Client error during image fetch: {e}") + PREDICTION_HISTORY.append('unknown') if len(PREDICTION_HISTORY) > PREDICTION_HISTORY_MAX_LENGTH: PREDICTION_HISTORY.pop(0) @@ -130,11 +132,13 @@ async def handle_root(request): async def handle_state(request): """Handler for the /state GET request.""" state = "unknown" + if len(PREDICTION_HISTORY) == PREDICTION_HISTORY_MAX_LENGTH: if all(s == "open" for s in PREDICTION_HISTORY): state = "open" elif all(s == "closed" for s in PREDICTION_HISTORY): state = "closed" + return web.Response(text=state) async def on_startup(app):