From fd17a92765c4bdc9350487a9b937eb3d4707dfa7 Mon Sep 17 00:00:00 2001 From: Michael McVady Date: Sat, 27 Jan 2024 21:27:38 -0600 Subject: Initial commit --- app.py | 22 ++++++++++++++++++++++ requirements.txt | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 app.py create mode 100644 requirements.txt diff --git a/app.py b/app.py new file mode 100644 index 0000000..d669836 --- /dev/null +++ b/app.py @@ -0,0 +1,22 @@ +from lifxlan import LifxLAN, BLUE + +from litestar import Litestar, get, post + + +@get("/") +async def index() -> str: + return "Hello, world!" + + +@post("/") +async def post_index() -> dict[str, str]: + lifxlan = LifxLAN() + try: + lifxlan.set_color_all_lights(BLUE, rapid=True) + except Exception as e: + return {"status": "error", "message": str(e)} + + return {"status": "ok"} + + +app = Litestar([index, post_index]) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b78356f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +lifxlan +litestar -- cgit v1.2.3