diff --git a/src/lvmapi/routers/enclosure.py b/src/lvmapi/routers/enclosure.py index 914befa..8b96950 100644 --- a/src/lvmapi/routers/enclosure.py +++ b/src/lvmapi/routers/enclosure.py @@ -96,7 +96,7 @@ async def status() -> EnclosureStatus: @router.route("/open") -async def open_enclosure(force:bool=False): +async def open_enclosure(force: bool = False): """Opens the enclosure.""" force_flag = "--force" if force else "" @@ -108,8 +108,9 @@ async def open_enclosure(force:bool=False): return True + @router.route("/close") -async def close_enclosure(force:bool=False): +async def close_enclosure(force: bool = False): """Closes the enclosure.""" force_flag = "--force" if force else "" @@ -120,3 +121,15 @@ async def close_enclosure(force:bool=False): raise HTTPException(status_code=500, detail=str(ee)) return True + + +@router.route("/stop") +async def stop_enclosure(): + """Stops the enclosure.""" + + try: + await send_clu_command("lvmecp dome stop") + except Exception as ee: + raise HTTPException(status_code=500, detail=str(ee)) + + return True