Skip to content

Commit

Permalink
Add stop dome endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Jun 15, 2024
1 parent d76706d commit 4b2eb78
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/lvmapi/routers/enclosure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand All @@ -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 ""
Expand All @@ -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

0 comments on commit 4b2eb78

Please sign in to comment.